| Revision 2573,
1.1 KB
checked in by daisuke, 16 years ago
(diff) |
|
fix bash3ism
- bash4's source (or .) command does not search current directory any longer.
|
| Line | |
|---|
| 1 | #! /bin/bash |
|---|
| 2 | |
|---|
| 3 | cd /etc/sysconfig/network-scripts |
|---|
| 4 | . /etc/sysconfig/network-scripts/network-functions |
|---|
| 5 | |
|---|
| 6 | CONFIG=$1 |
|---|
| 7 | source_config |
|---|
| 8 | |
|---|
| 9 | if [ "$TYPE" = "xDSL" ] && [ -x /sbin/adsl-stop -o -x /usr/sbin/adsl-stop ] ; then |
|---|
| 10 | adsl-stop /etc/sysconfig/network-scripts/$CONFIG |
|---|
| 11 | exit $? |
|---|
| 12 | fi |
|---|
| 13 | |
|---|
| 14 | CONFIG=${CONFIG##ifcfg-} |
|---|
| 15 | |
|---|
| 16 | if [ "${DEMAND}" = "yes" -a -f /var/run/ppp-${CONFIG}.pid ] ; then |
|---|
| 17 | PID=`head -1 /var/run/ppp-${CONFIG}.pid` |
|---|
| 18 | kill -TERM ${PID} |
|---|
| 19 | sleep 2 |
|---|
| 20 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 21 | sleep 5 |
|---|
| 22 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 23 | kill -TERM ${PID} |
|---|
| 24 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 25 | exit 1 |
|---|
| 26 | fi |
|---|
| 27 | |
|---|
| 28 | file=/var/run/pppwatch-${DEVICE}.pid |
|---|
| 29 | |
|---|
| 30 | if [ ! -f $file ]; then |
|---|
| 31 | # ppp isn't running, or we didn't start it |
|---|
| 32 | exit 0 |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
| 35 | PID=`cat $file` |
|---|
| 36 | [ -n "${PID}" ] || exit 1 |
|---|
| 37 | |
|---|
| 38 | kill -TERM ${PID} > /dev/null 2>&1 |
|---|
| 39 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 40 | sleep 2 |
|---|
| 41 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 42 | sleep 5 |
|---|
| 43 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 44 | sleep 10 |
|---|
| 45 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 46 | |
|---|
| 47 | # killing ppp-watch twice in a row causes it to send a SIGKILL to pppd pgrp |
|---|
| 48 | kill -TERM ${PID} > /dev/null 2>&1 |
|---|
| 49 | [ ! -d /proc/${PID} ] && exit 0 |
|---|
| 50 | |
|---|
| 51 | exit 1 |
|---|
Note: See
TracBrowser
for help on using the repository browser.