#!/bin/bash . /etc/init.d/functions cd /etc/sysconfig/network-scripts . ./network-functions CONFIG=${1} source_config [ -z "$CELLULAR_CID" ] && CELLULAR_CID=1 [ "${DEBUG}" = "yes" ] && CHATDBG="-v" CHATSCRIPT=$(mktemp /tmp/chatXXXXXX) cat > "$CHATSCRIPT" < "$MODEMPORT"; then echo $"Disconnect script failed (HSO)" fi # ask status (it also waits for device state to be cleaner) # do not fail if status querying fail cat > "$CHATSCRIPT" < "$MODEMPORT" rm -f "$CHATSCRIPT" ip addr flush dev "${DEVICE}" 2>/dev/null ip link set dev "${DEVICE}" down 2>/dev/null retcode=$? # wait up to 5 seconds for device to actually come down... waited=0 while ! check_device_down "${DEVICE}" && [ "$waited" -lt 50 ] ; do usleep 10000 (( waited++ )) done if [ "$retcode" = 0 ] ; then /etc/sysconfig/network-scripts/ifdown-post "$CONFIG" # do NOT use $? because ifdown should return whether or not # the interface went down. fi exit $retcode