-
-
Save benyanke/96b9586b24927ebc71d1044feea4a96d to your computer and use it in GitHub Desktop.
simple shell script to run pocketmine as a service/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/sh | |
### BEGIN INIT INFO | |
# Provides: pocketmine | |
# Required-Start: | |
# Required-Stop: | |
# Should-Start: | |
# Should-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start and stop pocketmine | |
# Description: PocketMine | |
### END INIT INFO | |
POCKETMINE_PATH="/home/pi/pocketmine" | |
START_OPTS="--start --background --pidfile /var/run/pocketmine.pid --make-pidfile --exec $POCKETMINE_PATH/start.sh" | |
STOP_OPTS="--stop --pidfile /var/run/pocketmine.pid" | |
test -x $DAEMON || exit 0 | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting PocketMine-MP: " | |
start-stop-daemon $START_OPTS > /dev/null | |
echo "ok." | |
;; | |
stop) | |
echo -n "Stopping PocketMine-MP: " | |
start-stop-daemon $STOP_OPTS | |
echo "ok." | |
rm -f /var/run/pocketmine.pid | |
;; | |
restart|force-reload) | |
echo -n "Restarting PocketMine-MP: " | |
start-stop-daemon $STOP_OPTS | |
sleep 1 | |
start-stop-daemon $START_OPTS > /dev/null | |
echo "ok." | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment