Skip to content

Instantly share code, notes, and snippets.

@Nokius
Last active August 29, 2015 14:08
Show Gist options
  • Save Nokius/fc88ca813b8bf33e5bda to your computer and use it in GitHub Desktop.
Save Nokius/fc88ca813b8bf33e5bda to your computer and use it in GitHub Desktop.
init audiobookplayer
#! /bin/sh
### BEGIN INIT INFO
# Provides: Audiobook-Player
# Required-Start: mpd
# Required-Stop:
# Default-Start: 2
# Default-Stop: 0 1 6
# Description: Startet das python-script fuer Audiobookplayer.py
### END INIT INFO
PATH=/usr/bin:/usr/lib:/usr/local/bin
case "$1" in
start)
python /home/pi/audiobookplayer.py > /var/log/audiobookplayer 2>&1 &
echo "Audiobook laeuft!"
;;
stop)
i=$(pgrep -f audiobookplayer)
kill -9 $i
echo > /var/log/audiobookplayer
echo "Audiobook gestopt!"
;;
*)
echo "Usage: /etc/init.d/audiobookplayer {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