a) Don't start your server as root (so don't use sudo). Change the owner of srcds by using chown <owner you want to be owner>.
b) Copy the script in the post you copied in a file (or the script below). Check the paths in the file. Save the file. Then do: chmod +x <file you've created>
c) Start the server: ./<file you've created>
Not the best (need some work), but this script also works (./css_start start).
#!/bin/bash
#-------------------------------------------------------
# COUNTER-STRIKE SOURCE START/STOP/RESTART/STATUS SCRIPT
#-------------------------------------------------------
# Start dit script met een van de volgende
# parameters: start/ stop/ restart/ status
#-------------------------------------------------------
# Door: Arjen
# Datum: 18-02-2005
# Notes: 20-02-2005- Parameter fast ingebouwd
# 13-04-2005- Dubbele start afgevangen
#-------------------------------------------------------
# VARIABELEN
#-------------------------------------------------------
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DIR=/usr/steam/srcds_l/orangebox
PROC=27015
NAME="Counter-Strike Source Public Server"
PARAMETERS="+maxplayers 18 +map de_dust2 +log on +ip <fill in IP> -pingboost 3 -game cstrike -console -autoupdate -verify_all -tickrate 100 -port 27015 +fps_max 100"
PARAMETERS2="+maxplayers 18 +map de_dust2 +log on +ip <fill in IP> -port 27015 -game cstrike -pingboost 3 -console -verify_all -tickrate 100 +fps_max 100"
#-------------------------------------------------------
case "$1" in
start)
if [[ `ps -ef | grep $PROC|grep srcds| grep -v grep` ]]
then
echo "Can't start $NAME. Status: online"
else
echo "Starting $NAME"
if [ -e $DIR ];
then
cd $DIR
./srcds_run $PARAMETERS &
else
echo "$DIR doesn't exist"
fi
fi
;;
stop)
if [[ `ps -ef | grep $PROC|grep srcds` ]]
then
echo "Killing $NAME"
kill -9 `ps -ef |grep $PROC |awk '{print $2}'`
else
echo "$NAME is OFFLINE"
fi
;;
restart)
if [[ `ps -ef | grep $PROC|grep srcds` ]]
then
echo "Killing $NAME"
kill -9 `ps -ef |grep $PROC |awk '{print $2}'`
else
echo "$NAME is OFFLINE"
fi
echo "Starting $NAME"
if [ -e $DIR ];
then
cd $DIR
./srcds_tk $PARAMETERS2 &
else
echo "$DIR doesn't exist"
fi
;;
fast)
echo "Fast starting $NAME"
if [ -e $DIR ];
then
cd $DIR
./srcds_run $PARAMETERS2 &
else
echo "$DIR doesn't exist"
fi
;;
status)
ps aux | grep -v grep | grep $PROC|grep srcds> /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "$NAME is ONLINE" || echo "$NAME is OFFLINE"
;;
*)
echo "Start with parameters: $0 {start|stop|status|restart|fast}"
exit 1
;;
esac
exit 0
b) Copy the script in the post you copied in a file (or the script below). Check the paths in the file. Save the file. Then do: chmod +x <file you've created>
c) Start the server: ./<file you've created>
Not the best (need some work), but this script also works (./css_start start).
#!/bin/bash
#-------------------------------------------------------
# COUNTER-STRIKE SOURCE START/STOP/RESTART/STATUS SCRIPT
#-------------------------------------------------------
# Start dit script met een van de volgende
# parameters: start/ stop/ restart/ status
#-------------------------------------------------------
# Door: Arjen
# Datum: 18-02-2005
# Notes: 20-02-2005- Parameter fast ingebouwd
# 13-04-2005- Dubbele start afgevangen
#-------------------------------------------------------
# VARIABELEN
#-------------------------------------------------------
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DIR=/usr/steam/srcds_l/orangebox
PROC=27015
NAME="Counter-Strike Source Public Server"
PARAMETERS="+maxplayers 18 +map de_dust2 +log on +ip <fill in IP> -pingboost 3 -game cstrike -console -autoupdate -verify_all -tickrate 100 -port 27015 +fps_max 100"
PARAMETERS2="+maxplayers 18 +map de_dust2 +log on +ip <fill in IP> -port 27015 -game cstrike -pingboost 3 -console -verify_all -tickrate 100 +fps_max 100"
#-------------------------------------------------------
case "$1" in
start)
if [[ `ps -ef | grep $PROC|grep srcds| grep -v grep` ]]
then
echo "Can't start $NAME. Status: online"
else
echo "Starting $NAME"
if [ -e $DIR ];
then
cd $DIR
./srcds_run $PARAMETERS &
else
echo "$DIR doesn't exist"
fi
fi
;;
stop)
if [[ `ps -ef | grep $PROC|grep srcds` ]]
then
echo "Killing $NAME"
kill -9 `ps -ef |grep $PROC |awk '{print $2}'`
else
echo "$NAME is OFFLINE"
fi
;;
restart)
if [[ `ps -ef | grep $PROC|grep srcds` ]]
then
echo "Killing $NAME"
kill -9 `ps -ef |grep $PROC |awk '{print $2}'`
else
echo "$NAME is OFFLINE"
fi
echo "Starting $NAME"
if [ -e $DIR ];
then
cd $DIR
./srcds_tk $PARAMETERS2 &
else
echo "$DIR doesn't exist"
fi
;;
fast)
echo "Fast starting $NAME"
if [ -e $DIR ];
then
cd $DIR
./srcds_run $PARAMETERS2 &
else
echo "$DIR doesn't exist"
fi
;;
status)
ps aux | grep -v grep | grep $PROC|grep srcds> /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "$NAME is ONLINE" || echo "$NAME is OFFLINE"
;;
*)
echo "Start with parameters: $0 {start|stop|status|restart|fast}"
exit 1
;;
esac
exit 0
Warning Level: 0%