Hi.
Würde gerne ein Skript haben, welches alle Gameserver auf meinem Root automatisch startet/restartet/stoppt.
Hab mir dazu ein Skript genommen welches es hier in einem Forum gab und versucht es anzupassen:
ZitatAlles anzeigenclear
# Edit and uncomment it to run the server as non-root
CS_USER="hlds"
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# LAN-server:
#PARAMS="-game cstrike -nomaster -insecure +sv_lan 1 +maxplayers 16 +map de_dust"
# Internet-server:
PARAMS1="-game cstrike +maxplayers 16 -port 27015 -ip xx.xx.xx.xx +map de_dust -autoupdate -vacbeta -tickrate 100"
PARAMS2="-game cstrike +maxplayers 20 -port 27070 -ip xx.xx.xx.xx +map de_dust -autoupdate -vacbeta -tickrate 100"
NAME=cstrike
DESC="CSS - All"
case "$1" in
start)
echo "Starting $DESC: $NAME"
if [ -e $DIR ];
then
cd $DIR
# Change the lines for running as non-root!
# su $CS_USER -l -c "screen -d -m -S $NAME $DAEMON $PARAMS"
screen -d -m -S $NAME /home/hlds/css_server/server1/srcds_run $PARAMS1
screen -d -m -S $NAME /home/hlds/css_server/server2/srcds_run $PARAMS2
else echo "No such directory!"
fi
;;
stop)
if [[ `screen -ls |grep $NAME` ]]
then
echo -n "Stopping $DESC: $NAME"
killall `screen -ls |grep $NAME
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
;;
restart)
if [[ `screen -ls |grep $NAME` ]]
then
echo -n "Stopping $DESC: $NAME"
killall `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
echo -n "Starting $DESC: $NAME"
cd $DIR
screen -d -m -S $NAME /home/hlds/css_server/server1/srcds_run $PARAMS1
screen -d -m -S $NAME /home/hlds/css_server/server2/srcds_run $PARAMS2
echo " ... done."
;;
status)
# Check whether there's a "hlds" process
# if "checkproc" is installed, you can use this:
# checkproc $DIR/hlds_run && echo "CS-Server RUNNING" echo "CS-Server NOT RUNNING"
# (thx to commander)
ps aux | grep -v grep | grep hlds_r > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "HLDS is UP" echo "HLDS is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0
Aber irgendwie wurde das nix =(. Der startet weder die Server beide richtig, noch beendet/restartet er sie :\.
Kann mir da jemand beim anpassen helfen ?