diff options
Diffstat (limited to 'games-action/teeworlds/files/teeworlds-init.d')
-rw-r--r-- | games-action/teeworlds/files/teeworlds-init.d | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/games-action/teeworlds/files/teeworlds-init.d b/games-action/teeworlds/files/teeworlds-init.d new file mode 100644 index 000000000000..7b9fd33bffee --- /dev/null +++ b/games-action/teeworlds/files/teeworlds-init.d @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +PIDFILE=/var/run/teeworlds.pid +GAME_DIRECTORY=/usr/games/bin +CONFIG=/etc/teeworlds/teeworlds_srv.cfg + +depend() { + use dns logger net +} + +checkconfig() { + if [ ! -e ${CONFIG} ] ; then + eerror "You need an ${CONFIG} config file to run TeeWorlds" + return 1 + fi +} + +start() { + ebegin "Starting TeeWorlds" + start-stop-daemon --start --background --pidfile "${PIDFILE}" \ + --make-pidfile -d ${GAME_DIRECTORY} --user games \ + --exec ${GAME_DIRECTORY}/teeworlds_srv -- -f ${CONFIG} + eend $? +} + +reload() { + ebegin "Reloading TeeWorlds configs and restarting processes" + start-stop-daemon --stop --oknodo --user games \ + --pidfile "${PIDFILE}" --signal HUP \ + --exec ${GAME_DIRECTORY}/teeworlds_srv -- -f ${CONFIG} + eend $? +} + +stop() { + ebegin "Stopping TeeWorlds" + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" + eend $? +} |