Screen process
Od HLDS.pl
(Różnice między wersjami)
(Utworzył nową stronę „Beszczelnie zajebalem kod Anubisa, z malymi przerobkami, nie testowany ;) <bash> #! /bin/bash # Copyright (c) 2009 Anubis, http://g4g.pl NAME=Game_Server_1 EXECUTABLE=...”) |
(+kategorie) |
||
Linia 53: | Linia 53: | ||
exit 0 | exit 0 | ||
</bash> | </bash> | ||
+ | |||
+ | [[Kategoria:Linux]] | ||
+ | [[Kategoria:Serwery gier]] | ||
+ | [[Kategoria:skróty]] | ||
+ | [[Kategoria:Skrypty]] |
Aktualna wersja na dzień 15:33, 29 kwi 2009
Beszczelnie zajebalem kod Anubisa, z malymi przerobkami, nie testowany ;)
#! /bin/bash # Copyright (c) 2009 Anubis, http://g4g.pl NAME=Game_Server_1 EXECUTABLE=./game_server PARAMS="+set dedicated 2 +set net_ip 192.168.1. +set net_port 27733 +set sv_punkbuster 1 +set fs_homepath /path/to/server/ +exec server.cfg +map_rotate" DIR=/path/to/server/ case "$1" in start) if [[ `screen -ls |grep $NAME` ]] then echo "Error: $NAME is already running, use '$0 stop' to stop it" else cd $DIR screen -dmS $NAME $EXECUTABLE $PARAMS echo "$NAME was started." fi ;; stop) if [[ `screen -ls |grep $NAME` ]] then kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'` echo "$NAME was stopped" else echo "Error: $NAME isn't currently running" fi ;; restart) if [[ `screen -ls |grep $NAME` ]] then kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'` fi cd $DIR screen -dmS $NAME $EXECUTABLE $PARAMS echo "$NAME was restarted" ;; status) if [[ `screen -ls |grep $NAME` ]] then echo "$NAME is currently running" else echo "$NAME is NOT running" fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0