0
我試圖修改這個非常簡單的外殼腳本,我寫了這個腳本來檢查屏幕是否已經激活,如果是,請不要創建它們。例如,如果我使用start
參數將該腳本調用兩次,則將創建四個屏幕會話。我想阻止這一點。在屏幕上啓動遊戲服務器的外殼腳本
#! /bin/sh
# /etc/init.d/css-server
#
case "$1" in
start)
echo "Starting Nullus Imprimis war server..."
screen -A -m -d -S css-war-server /home/css-servers/war-server/css/srcds_run -game cstrike +map de_dust2 +maxplayers 16 -autoupdate -port 2555
echo "Nullus Imprimis war server started"
echo "Starting Nullus Imprimis pub server #1..."
screen -A -m -d -S css-pub-server-1 /home/css-servers/pub-server-1/css/srcds_run -game cstrike +map de_dust2 +maxplayers 32 -autoupdate -port 2666
echo "Nullus Imprimis pub server #1 started"
;;
stop)
echo "Stopping Nullus Imprimis war server..."
screen -S css-war-server -X quit
echo "Nullus Imprimis war server stopped"
echo "Stopping Nullus Imprimis pub server #1..."
screen -S css-pub-server-1 -X quit
echo "Nullus Imprimis pub server #1 stopped"
;;
*)
echo "Usage: service css-servers {start|stop}"
exit 1
;;
esac
exit 0
而且,我要讓下自己的用戶名運行的服務器,在這種情況下css-servers
。我怎樣才能做到這一點?