Skip to content

Instantly share code, notes, and snippets.

@greg76
Last active March 26, 2020 10:54
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save greg76/db45f4bf9ab73803cd9aabc8311bde70 to your computer and use it in GitHub Desktop.
Save greg76/db45f4bf9ab73803cd9aabc8311bde70 to your computer and use it in GitHub Desktop.
simple shell script to run pocketmine as a service/daemon
#!/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
@BANKRTDV
Copy link

BANKRTDV commented Aug 2, 2019

oh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment