added stop fonctionaly into the script as it is useful for daemon mode.

This commit is contained in:
Ozan Turkyilmaz 2008-12-12 13:49:58 +00:00
parent c8e460e668
commit 7b53efac69

View file

@ -3,10 +3,12 @@
# SERVER STARTUP SCRIPT # SERVER STARTUP SCRIPT
# Sets the appropriate environmental variables and launches the server # Sets the appropriate environmental variables and launches the server
# process. Run without flags for daemon mode. # process. Run without flags for daemon mode.
# It can be used for stoping the server.
# #
# FLAGS # FLAGS
# -i Interactive mode # -i Interactive mode
# -d Daemon mode # -d Daemon mode
# -s Stop the running server
# -h Show help display # -h Show help display
############################################################################# #############################################################################
@ -30,6 +32,11 @@ startup_daemon() {
twistd --logfile=logs/evennia.log --python=src/server.py twistd --logfile=logs/evennia.log --python=src/server.py
} }
stop_server() {
## Stops the running server
kill `cat twistd.pid`
}
help_display() { help_display() {
echo "SERVER STARTUP SCRIPT" echo "SERVER STARTUP SCRIPT"
echo "Sets the appropriate environmental variables and launches the server" echo "Sets the appropriate environmental variables and launches the server"
@ -38,6 +45,7 @@ help_display() {
echo "FLAGS" echo "FLAGS"
echo " -i Interactive mode" echo " -i Interactive mode"
echo " -d Daemon mode" echo " -d Daemon mode"
echo " -s Stop the running server"
echo " -h Show help display" echo " -h Show help display"
} }
@ -49,6 +57,9 @@ case "$1" in
'-d') '-d')
startup_daemon startup_daemon
;; ;;
'-s')
stop_server
;;
'--help') '--help')
help_display help_display
;; ;;