#!/bin/sh
#
# Synology DSM init script for SickBeard
# Requires: sickbeard
#           python 
#           wget
#
# Configured Variables:
#
PYTHON_EXEC="/opt/bin/python2.6"
SICKBEARD_EXEC="/opt/share/sickbeard/SickBeard.py"
SICKBEARD_PORT="9201"

# Begin script
#
case "$1" in
start)
  printf "%-30s" "Starting SickBeard"
  nohup ${PYTHON_EXEC} ${SICKBEARD_EXEC} -q -d > /dev/null 2>&1 &
  printf "[%4s]\n" "done"
  ;;
stop)
  printf "%-30s" "Stopping SickBeard"
  /opt/bin/wget -q --delete-after "http://127.0.0.1:${SICKBEARD_PORT}/home/shutdown/"
  printf "[%4s]\n" "done"
  ;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac
            
exit 0

