SRCDS Steam group


Detach server from ssh session?
#1
Operating system - Linux CentOS
Server - Fortress Forever

The server is up and running fine, but when I CTRL+C, or close the Putty session, the server stops.

Here is the command line I'am using to start the server:

./srcds_run -console -game FortressForever -port 27015 +ip 67.222.141.240 +map ff_2fort +maxplayers 14

I found this in the Steamforums, but do not understand "where" I am supposed to put the code.

Quote:To place the server in a screen session you may detach from once its launched, or place the line in start_server.sh and exeucte it from the command line.
Reply
#2
We will make a script that will run the srcds in the background in a "screen"
you will need to have screen installed for this. make a file called server.sh and put this in:

Code:
#!/bin/sh
echo "Starting Cs:Source Server"
sleep 1
screen -A -m -d -S css-server ./srcds_run -console -game cstrike +map de_dust +maxplayers 16 -autoupdate
Save the file, and chmod it to run
Code:
chmod +x server.sh

If you want to start your server, simply run server.sh . It will start your srcd server in the background, to open it type:

Code:
screen -x css-server

If you want to close it again press ctrl+a+d, and it will detach the screen and keep it running in the background.

Its all right here
Reply
#3
Thank you for the reply.

I created a server.sh file, made it executable, but this is where I am having problems

Quote:If you want to start your server, simply run server.sh

When I run the file ./server.sh an error comes back - no such file or directory.
Reply
#4
put the server.sh in the same place as the srcds_run in it
Reply
#5
helixo Wrote:put the server.sh in the same place as the srcds_run in it

It is, I'am looking at the FTP and SSH window right now - I have two windows open to the server.

Is that the correct command to run the script ./server.sh

Here is the code from the server.sh file

#!/bin/sh
echo "Starting Fortress Forever"
sleep 1
screen -A -m -d -S Fop ./srcds_run -console -game FortressForever +map ff_2fort +maxplayers 14 -autoupdate -secure
Reply
#6
is the file in the same folder as you would execute the cmd in
Reply
#7
helixo Wrote:is the file in the same folder as you would execute the cmd in

Yes,

The server.sh file is in the same directory as the srcds_run file and the same directory that I enter the command line.

Permissions on server.sh are 755.

---------- EDIT --------------

PArt of the problem, I had to remove the #!/bin/sh from the server.sh file. After removing that and the sleep command, its making some progress

-------- EDIT ---------------

I removed the screen -A -m -d -S from the file, it was causing an "unknown command" error. But now the fiel is launching the Fortress Forever server.

--------- EDIT -----------

Here is the error that I get with the screen commands in place screen -A -m -d -S


# ./server.sh
Starting Fortress Forever Server
: command not found:
Use: screen [-opts] [cmd [args]]
or: screen -r [host.tty]
Reply
#8
When you don't use Screen just add a & behind your startup-line ... that's all:

./srcds_run -console -game FortressForever -port 27015 +ip 67.222.141.240 +map ff_2fort +maxplayers 14 &
Reply
#9
Arjen Wrote:When you don't use Screen just add a & behind your startup-line

that might not work with all shells, some will kill their childs (i.e. the server in that case) on logout...
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#10
Press ctl+a+d to detach
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)