Last active
March 26, 2020 10:54
-
-
Save greg76/db45f4bf9ab73803cd9aabc8311bde70 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 |
nice but how would you logon to the server to change / adjust things for players ? I see some other scripts using screen. Any thoughts ?
Thanks !
oh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
after saving the script to your home or pocketmine folder, make it executable and set it up to be launched on bootup: