Guest User

Untitled

a guest
Dec 24th, 2010
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # xl2tpd This shell script takes care of starting and stopping l2tpd.
  4. #
  5. # description: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
  6. #
  7.  
  8. # processname: xl2tpd
  9. CONFIG_FILE=/etc/xl2tpd/xl2tpd.conf
  10. SECRETS_FILE=/etc/ppp/chap-secrets
  11. DAEMON=xl2tpd
  12.  
  13. [ -x /usr/sbin/$DAEMON ] || exit 0
  14.  
  15. RETVAL=0
  16.  
  17. start() {
  18. echo "Starting $DAEMON..."
  19. if [ ! -d /var/run/xl2tpd ];then
  20. mkdir /var/run/xl2tpd
  21. fi
  22. /usr/sbin/$DAEMON -c $CONFIG_FILE -s $SECRETS_FILE &
  23. RETVAL=$?
  24. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON
  25. return $RETVAL
  26. }
  27.  
  28. stop() {
  29. echo "Stopping $DAEMON..."
  30. kill -9 `cat /var/run/xl2tpd.pid`
  31. RETVAL=$?
  32. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON
  33. return $RETVAL
  34. }
  35.  
  36. restart() {
  37. stop
  38. start
  39. }
  40.  
  41. status() {
  42. PID="`ps ax | awk '{if (match($5, ".*/xl2tpd$") || $5 == "xl2tpd") print $1}'`"
  43. if test "$PID" != ""; then
  44. echo "xl2tpd is running."
  45. else
  46. echo "xl2tpd is not running."
  47. fi
  48. }
  49.  
  50.  
  51. # See how we were called.
  52. case "$1" in
  53. start)
  54. start
  55. ;;
  56. stop)
  57. stop
  58. ;;
  59. status)
  60. status
  61. ;;
  62. restart|reload)
  63. restart
  64. ;;
  65. condrestart)
  66. [ -f /var/lock/subsys/$DAEMON ] && restart || :
  67. ;;
  68. *)
  69. echo "Usage: $DAEMON {start|stop|status|restart|reload|condrestart}"
  70. exit 1
  71. esac
Advertisement
Add Comment
Please, Sign In to add comment