|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# replace with the user you created above
SRCDS_USER="sebastian"
# Do not change this path
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# The path to the game you want to host. example = /home/newuser/dod
DIR=/home/sebastian/tf/orangebox
DAEMON=$DIR/srcds_run
# Change all PARAMS to your needs.
PARAMS="-game tf +map cp_badlands"
NAME=SRCDS
DESC="source dedicated server"
case "srcds_run" in
start)
echo "Starting $DESC: $NAME"
if [ -e $DIR ]; then
cd $DIR
su $SRCDS_USER -l -c "screen -d -m -S $NAME $DAEMON $PARAMS"
else
echo "No such directory: $DIR!"
fi
;;
stop)
if screen -ls |grep $NAME; then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Couldn't find a running $DESC"
fi
;;
restart)
if screen -ls |grep $NAME; then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Couldn't find a running $DESC"
fi
echo -n "Starting $DESC: $NAME"
cd $DIR
screen -d -m -S $NAME $DAEMON $PARAMS
echo " ... done."
;;
status)
# Check whether there's a "srcds" process
ps aux | grep -v grep | grep srcds_r > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "SRCDS is UP" || echo "SRCDS is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »fluxX« (15. März 2013, 07:42)
Benutzerinformationen überspringen
Wohnort: Hagen
Beruf: Mechatroniker (didaktische Systeme)
Rootserver vorhanden: Nein
|
|
Quellcode |
1 |
#!/bin/bash |
|
|
Quellcode |
1 |
case "$1" in |
|
|
Quellcode |
1 |
"status") |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
#!/bin/bash
# replace with the user you created above
SRCDS_USER="sebastian"
# Do not change this path
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# The path to the game you want to host. example = /home/Sebastian/tf/dod
DIR=/home/sebastian/tf/orangebox
DAEMON=$DIR/srcds_run
# Change all PARAMS to your needs.
PARAMS="-game tf +map cp_badlands"
NAME=SRCDS
DESC="source dedicated server"
case "$1" in
start)
echo "Starting $DESC: $NAME"
if [ -e $DIR ]; then
cd $DIR
su $SRCDS_USER -l -c "screen -d -m -S $NAME $DAEMON $PARAMS"
else
echo "No such directory: $DIR!"
fi
;;
stop)
if screen -ls |grep $NAME; then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Couldn't find a running $DESC"
fi
;;
restart)
if screen -ls |grep $NAME; then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
echo " ... done."
else
echo "Couldn't find a running $DESC"
fi
echo -n "Starting $DESC: $NAME"
cd $DIR
screen -d -m -S $NAME $DAEMON $PARAMS
echo " ... done."
;;
status)
# Check whether there's a "srcds" process
ps aux | grep -v grep | grep srcds_r > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "SRCDS is UP" || echo "SRCDS is DOWN"
;;
*)
echo "Usage: $0 {"start"|"stop"|"status"|"restart"}"
exit 1
;;
esac
exit 0
[/spoiler]
|
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Dubstep007« (16. März 2013, 18:23)
Benutzerinformationen überspringen
Wohnort: Hagen
Beruf: Mechatroniker (didaktische Systeme)
Rootserver vorhanden: Nein