Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.