init-script for airvideo-server using start-stop-daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should that be
chmod +x
in the comments section instead of chmod +w?