-
-
Save BKPepe/ed8b9cde3675e48642dc55a8e81d5985 to your computer and use it in GitHub Desktop.
JDownloader 2 headless startup script (starts jdownloader as non root user jd)
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/sh | |
### BEGIN INIT INFO | |
# Provides: JDownloader2 | |
# Required-Start: networking | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: JDownloader2 server daemon | |
# Description: JDownloader2 server daemon | |
### END INIT INFO | |
DIR="/home/jdownloader" | |
PIDFILE="$DIR/JDownloader.pid" | |
JAVA="/usr/bin/java" | |
PARAM="-Djava.awt.headless=true -jar $DIR/JDownloader.jar" | |
USER="root" | |
start_daemon () { | |
start-stop-daemon --start --background --oknodo --chuid $USER --make-pidfile --pidfile $PIDFILE --exec $JAVA -- $PARAM | |
} | |
stop_daemon () { | |
start-stop-daemon --stop --pidfile $PIDFILE | |
} | |
# Switch case | |
case "$1" in | |
start) | |
# On start | |
echo "Start JDownloader" | |
start_daemon | |
;; | |
stop) | |
# On stop | |
echo "Stop JDownloader" | |
stop_daemon | |
;; | |
restart) | |
# On restart | |
echo "Restart JDownloader" | |
start_daemon | |
stop_daemon | |
;; | |
*) | |
# Default action | |
echo "(start|stop|restart)" | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment