Created
March 11, 2014 16:37
-
-
Save kajic/9489581 to your computer and use it in GitHub Desktop.
init.d script for twofishes, assumes you have a twofishes user with the binary and data in /home/twofishes/opt/twofishes
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 | |
JAVA=/usr/bin/java | |
JAR=/home/twofishes/opt/twofishes/server-assembly-0.81.9.jar | |
DATA=/home/twofishes/opt/twofishes/data/ | |
OPTS="-Xmx4096m -jar $JAR --hfile_basepath $DATA --preload 1 --warmup 1" | |
NAME=twofishes | |
DESC=twofishes | |
test -x $JAVA || exit 0 | |
test -e $JAR || exit 0 | |
test -d $DATA || exit 0 | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
start-stop-daemon --start --verbose --background --chuid "twofishes:twofishes" --make-pidfile --pidfile /var/run/$NAME.pid \ | |
--exec $JAVA -- $OPTS || true | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
start-stop-daemon --stop --verbose --chuid "twofishes:twofishes" --pidfile /var/run/$NAME.pid \ | |
--exec $JAVA || true | |
echo "$NAME." | |
;; | |
*) | |
echo "Usage: $NAME {start|stop}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment