lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ###################################################################### |
| 3 | # |
| 4 | # Determine the device to be terminated. |
| 5 | # |
| 6 | if [ "$1" = "" ]; then |
| 7 | DEVICE=ppp0 |
| 8 | else |
| 9 | DEVICE=$1 |
| 10 | fi |
| 11 | |
| 12 | ###################################################################### |
| 13 | # |
| 14 | # If the ppp0 pid file is present then the program is running. Stop it. |
| 15 | if [ -r /var/run/$DEVICE.pid ]; then |
| 16 | kill -INT `cat /var/run/$DEVICE.pid` |
| 17 | # |
| 18 | # If the kill did not work then there is no process running for this |
| 19 | # pid. It may also mean that the lock file will be left. You may wish |
| 20 | # to delete the lock file at the same time. |
| 21 | if [ ! "$?" = "0" ]; then |
| 22 | rm -f /var/run/$DEVICE.pid |
| 23 | echo "ERROR: Removed stale pid file" |
| 24 | exit 1 |
| 25 | fi |
| 26 | # |
| 27 | # Success. Let pppd clean up its own junk. |
| 28 | echo "PPP link to $DEVICE terminated." |
| 29 | exit 0 |
| 30 | fi |
| 31 | # |
| 32 | # The ppp process is not running for ppp0 |
| 33 | echo "ERROR: PPP link is not active on $DEVICE" |
| 34 | exit 1 |