Skip to content

Instantly share code, notes, and snippets.

@vartana
Last active July 13, 2016 20:20
Show Gist options
  • Save vartana/2bb55334d9dd91bd27918e94c26829bc to your computer and use it in GitHub Desktop.
Save vartana/2bb55334d9dd91bd27918e94c26829bc to your computer and use it in GitHub Desktop.
#! /bin/sh
### BEGIN INIT INFO
# Provides: streamradio
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage my cool stuff
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
# If you need to source some other scripts, do it here
case "$1" in
start)
log_begin_msg "Starting audio-stream"
omxplayer http://185.109.161.87:8000/stream --amp 600
exit 0
;;
stop)
log_begin_msg "Stopping the coolest service ever unfortunately"
# do something to kill the service or cleanup or nothing
kill $(ps aux | grep 'omxplayer' | awk '{print $2}')
exit 0
;;
*)
echo "Usage: /etc/init.d/streamradio {start|stop}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment