Skip to content

Instantly share code, notes, and snippets.

@aq1018
Created April 6, 2011 07:44
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aq1018/905291 to your computer and use it in GitHub Desktop.
Save aq1018/905291 to your computer and use it in GitHub Desktop.
init-script for airvideo-server using start-stop-daemon
#!/bin/bash
#
# create a new user called airvideo
# $ sudo adduser airvideo
# place this file in /etc/init.d/airvideo-server
# change the file permission to executable:
# $ sudo chmod +w /etc/init.d/airvideo-server
# add it to default run level
# $ sudo update-rc.d airvideo-server defaults
#
# Notes: make sure the folders in /opt/airvideo-server/AirVideoServerLinux.properties are readable by airvideo user
case "$1" in
start)
echo "Starting AirVideo"
start-stop-daemon --start --quiet -b -m -p /var/run/airvideo-server.pid --chuid airvideo --exec /usr/bin/java -- -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.properties
;;
stop)
echo "Stopping AirVideo"
start-stop-daemon --stop --quiet --pidfile /var/run/airvideo-server.pid
rm -f /var/run/airvideo-server
;;
*)
echo "Usage: /etc/init.d/airvideo-server {start|stop}"
exit 1
;;
esac
exit 0
@daluu
Copy link

daluu commented May 4, 2016

Should that be chmod +x in the comments section instead of chmod +w?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment