Skip to content

Instantly share code, notes, and snippets.

@crsantos
Created March 25, 2012 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crsantos/2199084 to your computer and use it in GitHub Desktop.
Save crsantos/2199084 to your computer and use it in GitHub Desktop.
init.d daemon for Plex-Trakt scrobbler
#!/bin/bash
USER="CHANGE_NAME"
NAME=traktscrobbler
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/bin/python
SCRIPT=/CHANGE/PATH/TO/Plex-Trakt-Scrobbler/script.py
case "$1" in
start)
echo "Starting $NAME"
start-stop-daemon --start --quiet --user $USER --background --pidfile $PIDFILE --make-pidfile --exec $DAEMON $SCRIPT > /dev/null
echo "$NAME started!"
;;
stop)
echo "Stopping $NAME"
/sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment