export PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin script_name="ip-${script_op}[$$]" logger -t $script_name "starting ..." # Wait for end of boot while [ ! -f /var/run/boot_finished ] do sleep 1 done if [ -f /var/run/syslogd.pid ]; then exec > /tmp/ip-$script_op.$$ 2>&1 else exec >/dev/console 2>&1 fi [ -f /var/run/debug_ipup ] && set -x real_interface=$1 interface=$1 tty=$2 speed=$3 local=$4 remote=$5 lock_file=/var/lock/pppd.$interface # Wait for other ip-up/ip-down instances while [ -f $lock_file ] do if [ -f /var/run/debug_ipup ]; then { echo "waiting for other ip-up/ip-down instances ..." ps | grep -e ip-up -e ip-down } | logger -t $script_name fi sleep 1 done > $lock_file logger -t $script_name " executing ip-$script_op scripts ..." run_ip_$script_op logger -t $script_name " finished ip-$script_op scripts ..." rm -f $lock_file set +x if [ -f /tmp/ip-$script_op.$$ ] then { echo "dumping debug trace of ip-$script_op ..." sed -e "s/`echo -e '\033'`\[[0-9]\+m//g" /tmp/ip-$script_op.$$ echo "end of debug trace of ip-$script_op ..." } | logger -t $script_name rm -f /tmp/ip-$script_op.$$ fi logger -t $script_name "terminating ..." exit 0