SRCDS Steam group


SSH PuTTy can't run serv in background
#1
Ok i have remote server, dedicated server. So i have ftp and ssh access to it, and want to use it for CS: Source dedicated server. I've installed srcds (10x to this site) and configured the server so it works fine. I use Putty to connect to it and to start the server, but when i close putty server stops. This seems to be a problem to me because i can't run always putty.
So when i start the srcds and i am into a console, if i type exit it shuts down the server not the ssh. I've read how to make it background procces from the guides and also saw this script - http://forums.srcds.com/showthread.php?tid=516&page=2
But i'cant install screen because i don't have rights to Sad
Is there more simple solution to make it run without putty on ?
Reply
#2
That script looks a little involved. (I might have to try it) Maybe you what to start out with a simpler one at first. Here is what I use for dod:source:

#!/bin/sh
cd $HOME/srcds_1
export LD_LIBRARY_PATH=$HOME/srcds_1:$LD_LIBRARY_PATH
/usr/bin/screen -A -m -d -S dod ./srcds_run -game dod -port 27015 +map dod_donner +maxplayers 12

I saw you said you don't have screen so this probably won't work for you either.
Reply
#3
I found a several solutions which may be very usefull for people who bought dedicated servers and access via ssh.
My box is working with debian distro so here are several solutions in which you don't need screen and this long scripts:

1. You can run the ./srcds_run with simple nohup command in the begining. nohup means nohangup and it will save srcds's ass after you kill the ssh connection. If you don't use this the server will be terminated. So simply type:

nohup ./srcds_run -console -game....(all the parameters you use)
Then kill the ssh connection from task manager

2. You can run it in background:
./srcds_run -console -game...(all the parameters) >/dev/null 2>&1 &
This I don't recommend to you, you can face some bad utilization for your server.

3. Run with the at command. at runs things in a specified time. For example you can type:

at now + 3 minute
then it will ask you what cmd to be run with at> in front, so type:
cd srcds_l (or the dir of srcds)
./srcds_run -console -game....(parameters)
Then hit CTRL+C and exit from the shell Wink

You can use man at for more information.

I use the 1st method, it is simple and works fine.
This which you can't have here is that you can't go back into the process (srcds). But who cares, use rcon or hlsw instead of those long scripts and screen. If you need to restart the server you can do it via rcon exit, if you want to stop it, connect to the shell and kill the process, the safest is to kill all you can with:
kill -9 -1

Hope this was usefull Smile
Reply
#4
If you have access to screen you can use it to start the server and then detach it (allows it to run in the background while you are disconnected). You can then reattach the server to your console when you connect again.

Ex below:
-S more or less names the screen, hlds is any name you want to assign to it. I use a script file to launch the server so I do not have to type "./srcds_run -console -game ..." every time I start it.

screen -S hlds ./srcds_run -console -game ...

To detach the server from your console session just hit CTRL+A+D, you should be returned to the console at this point. Disconnect normally.

Reconnect and type "screen -r hlds" to reattach the screen.
Reply
#5
First of all im sorry for bringing up old thread but i had same problem so my buddy wrote a script for me:
Quote:#! /bin/sh
#
#

RETVAL=0

# See how we were called.
case "$1" in
start)
cd /server/HLDS_SOURCE
/bin/sh ./srcds_run -game cstrike +maxplayers 10 +map de_nuke +fps_max 600 &
;;
stop|status|restart|reload)
;;
*)
echo "Usage: cs_ctrl {start|stop|status|restart|reload}"
exit 1
esac
exit $RETVAL
script is called css so i login with putty and just type: ./css start

Not the best way but it still works for me and no need for screen Smile
SNR
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)