Advertisement
Guest User

mayu

a guest
Dec 21st, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | None | 0 0
  1.  
  2. #! /bin/bash
  3.  
  4. . /etc/rc.conf
  5. . /etc/rc.d/functions
  6.  
  7. DAEMON=mayu
  8. USER=/root/
  9.  
  10. PID=$(pidof -o %PPID /usr/bin/mayu)
  11.  
  12. case "$1" in
  13.     start)
  14.         stat_busy "Starting $DAEMON"
  15.         env HOME=$USER \
  16.             [ -z "$PID" ] && $DAEMON &
  17.         if [ $? -gt 0 ]; then
  18.             stat_fail
  19.         else
  20.             add_daemon $DAEMON
  21.             stat_done
  22.         fi
  23.         ;;
  24.     stop)
  25.         stat_busy "Stopping $DAEMON"
  26.         [ ! -z "$PID" ]  && kill $PID &
  27.         if [ $? -gt 0 ]; then
  28.             stat_fail
  29.         else
  30.             rm_daemon $DAEMON
  31.             stat_done
  32.         fi
  33.         ;;
  34.     restart)
  35.         $0 stop
  36.         sleep 1
  37.         $0 start
  38.         ;;
  39.     *)
  40.         echo "usage: $0 {start|stop|restart}"
  41. esac
  42. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement