Advertisement
Twissel

sh*t-init

Jan 3rd, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.24 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # ipv6assignd- this script starts and stops dhcp6 daemon
  4. #
  5. # chkconfig:     345 85 15
  6. # description: A simple dhcp ipv6 daemon for tcp_proxy
  7. # processname: ipv6assignd
  8. # config:      /etc/ipv6assignd.cfg
  9. # pidfile:     /tmp/ipv6assignd.pid
  10.  
  11. # Source function library.
  12. . /etc/rc.d/init.d/functions
  13.  
  14. # Source networking configuration.
  15. . /etc/sysconfig/network
  16.  
  17. # Check that networking is up.
  18. [ "$NETWORKING" = "no" ] && exit 0
  19.  
  20. ipv6assignd="/usr/bin/ipv6assignd"
  21. prog=$(basename $ipv6assignd)
  22. pidfile="/tmp/ipv6assignd.pid"
  23.  
  24. DHCP6_CONF_FILE="/etc/ipv6assignd.cfg"
  25.  
  26.  
  27.  
  28. start() {
  29.     [ -x $ipv6assignd ] || exit 5
  30.     [ -f $DHCP6_CONF_FILE ] || exit 6
  31.     echo -n $"Starting $prog: "
  32.     daemon $ipv6assignd -c $DHCP6_CONF_FILE
  33.     retval=$?
  34.     echo
  35.     [ $retval -eq 0 ] && touch $pidfile
  36.     return $retval
  37. }
  38.  
  39. stop() {
  40.     echo -n $"Stopping $prog: "
  41.     killproc $prog -QUIT
  42.     retval=$?
  43.     echo
  44.     [ $retval -eq 0 ] && rm -f $pidfile
  45.     return $retval
  46. }
  47.  
  48. restart() {
  49.     stop
  50.     start
  51. }
  52.  
  53. case "$1" in
  54.     start)
  55.         $1
  56.         ;;
  57.     stop)
  58.         $1
  59.         ;;
  60.     restart)
  61.         $1
  62.         ;;
  63.     *)
  64.         echo $"Usage: $0 {start|stop|restart}"
  65.         exit 2
  66. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement