From f2fda4b1bd1fad637e6de45a0db35f14c4ad80a1 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 9 Dec 2016 20:23:35 +0100 Subject: [PATCH] Make some fixes to the linux/unix start scripts. --- bin/unix/evennia-screen-initd.sh | 13 ++++++++++++- bin/unix/evennia-screen.sh | 14 ++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/bin/unix/evennia-screen-initd.sh b/bin/unix/evennia-screen-initd.sh index 1300e185d5..22e470b86b 100644 --- a/bin/unix/evennia-screen-initd.sh +++ b/bin/unix/evennia-screen-initd.sh @@ -1,3 +1,4 @@ +#!/bin/bash # # Evennia init.d Screen launcher script (Linux) # @@ -33,4 +34,14 @@ SCRIPTPATH="/home/muddev/mud/mygame/server/evennia-screen.sh" USER="muddev" #------------------------------------------------------------ -su - "$USER" -c "$SCRIPTPATH $1" +case $1 in + start | stop | reload | restart) + # run the start script and forward the argument to it + su - "$USER" -c "$SCRIPTPATH $1" + ;; + *) + echo "Usage: evennia {start|stop|restart|reload}" + exit 1 + ;; +esac +exit 0 diff --git a/bin/unix/evennia-screen.sh b/bin/unix/evennia-screen.sh index 403fccd681..955ec2c78a 100644 --- a/bin/unix/evennia-screen.sh +++ b/bin/unix/evennia-screen.sh @@ -40,7 +40,7 @@ case $1 in echo "(Re-)Starting Evennia." cd "$GAMEDIR" touch "$GAMEDIR"/server/logs/server.log - screen -S $GAMENAME -p evennia -X stuff 'evennia start --log \n' + screen -S $GAMENAME -p evennia -X stuff 'evennia --log start\n' else # start GNU Screen then run it with this same script, making sure to # not start Screen on the second call @@ -51,8 +51,14 @@ case $1 in # this is executed inside the GNU Screen session source "$VIRTUALENV"/bin/activate cd "$GAMEDIR" + # these will fail unless server died uncleanly + rm "$GAMEDIR"/server/server.pid + rm "$GAMEDIR"/server/portal.pid + # make sure it exists for the first startup touch "$GAMEDIR"/server/logs/server.log - evennia start + # start evennia itself + evennia --log start + # we must run this to avoid the screen session exiting immediately exec sh fi ;; @@ -63,11 +69,11 @@ case $1 in ;; reload | restart) cd "$GAMEDIR" - screen -S "$GAMENAME" -p evennia -X stuff 'evennia reload --log\n' + screen -S "$GAMENAME" -p evennia -X stuff 'evennia --log reload\n' echo "Reloading Evennia." ;; *) - echo "Usage: start_evennia {start|stop|restart|reload}" + echo "Usage: evennia-screen.sh {start|stop|restart|reload}" exit 1 ;;