View difference between Paste ID: i879rQ5U and FYFXfCAq
SHOW: | | - or go back to the newest paste.
1
#!/bin/bash
2
3
. /etc/rc.conf
4
. /etc/rc.d/functions
5
. /etc/conf.d/sickbeard
6
7
case "$1" in
8
  start)
9
    stat_busy "Starting Sick-Beard"
10
11
    if [ -f /var/run/daemons/sickbeard ]; then
12
      echo -n "Sickbeard is already running as a daemon! If you are certain it is not running, remove /var/run/daemons/sickbeard."
13
      stat_fail
14
    else
15
      su - $SB_USER -c "$SB_PYTHON $SB_BIN -q -d --data $SB_DATA --config $SB_CONF --port $SB_PORT" -s /bin/sh
16
      if [ $? -gt 0 ]; then
17
        stat_fail
18
      else
19
        add_daemon sickbeard
20
        stat_done
21
      fi
22
    fi
23
    ;;
24
  stop)
25
    stat_busy "Stopping Sick-Beard"
26
27
 
28
    wget -q --delete-after $SB_PROTOCOL://${SB_USPW}localhost:$SB_PORT$SB_WEBROOT/home/shutdown/ &> /dev/null
29
30
    if [ "${?}" -gt 0 ]; then
31
      stat_fail
32
    else
33
      rm_daemon sickbeard
34
      stat_done
35
    fi
36
    ;;
37
  restart)
38
    "${0}" stop
39
    sleep 1
40
    "${0}" start
41
    ;;
42
  *)
43
    echo "usage: ${0} {start|stop|restart}"
44
esac
45
exit 0