ppp-off 967 B

12345678910111213141516171819202122232425262728293031323334
  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. # If the ppp0 pid file is present then the program is running. Stop it.
  14. if [ -r /var/run/$DEVICE.pid ]; then
  15. kill -INT `cat /var/run/$DEVICE.pid`
  16. #
  17. # If the kill did not work then there is no process running for this
  18. # pid. It may also mean that the lock file will be left. You may wish
  19. # to delete the lock file at the same time.
  20. if [ ! "$?" = "0" ]; then
  21. rm -f /var/run/$DEVICE.pid
  22. echo "ERROR: Removed stale pid file"
  23. exit 1
  24. fi
  25. #
  26. # Success. Let pppd clean up its own junk.
  27. echo "PPP link to $DEVICE terminated."
  28. exit 0
  29. fi
  30. #
  31. # The ppp process is not running for ppp0
  32. echo "ERROR: PPP link is not active on $DEVICE"
  33. exit 1