Advertisement
schreiberstein

supybot-daemon-script

Apr 4th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.74 KB | None | 0 0
  1. /etc/rc.d/crond
  2. #!/bin/bash
  3.  
  4. . /etc/rc.conf
  5. . /etc/rc.d/functions
  6.  
  7. # Configuration section
  8.  
  9. DAEMON=supybot
  10. USER=python
  11.  
  12. # Script section
  13.  
  14. [ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
  15.  
  16. PID=$(get_pid $DAEMON)
  17.  
  18. case "$1" in
  19.  start)
  20.    stat_busy "Starting $DAEMON"
  21.    su $USER -c '/usr/bin/supybot ~/supybot/VBL_Bot.conf &' &>/dev/null
  22.    if [ $? = 0 ]; then
  23.      add_daemon $DAEMON
  24.      stat_done
  25.    else
  26.      stat_fail
  27.      exit 1
  28.    fi
  29.    ;;
  30.  stop)
  31.    stat_busy "Stopping $DAEMON"
  32.    killall supybot
  33.    if [ $? = 0 ]; then
  34.      rm_daemon $DAEMON
  35.      stat_done
  36.    else
  37.      stat_fail
  38.      exit 1
  39.    fi
  40.    ;;
  41.  restart)
  42.    $0 stop
  43.    sleep 1
  44.    $0 start
  45.    ;;
  46.  *)
  47.    echo "usage: $0 {start|stop|restart}"
  48. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement