Last active
August 19, 2021 09:51
-
-
Save WtfJoke/45796a5cfb0e746c84eb0d5b4650e11c 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/jd/jdownloader" | |
PIDFILE="$DIR/JDownloader.pid" | |
JAVA="/usr/bin/java" | |
PARAM="-Djava.awt.headless=true -jar $DIR/JDownloader.jar" | |
USER="jd" | |
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 |
how to use this??
Its been a while, but I think its an init.d script which can be placed to the other scripts, which are ran at startup.
Depending on your system the default scripts can be found in /etc/init.d
.
However, I'm not using that script anymore.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use this??