SRCDS Steam group


Linux Dedi Server Help.
#1
I just started to use Linux for the dedi box we rented. I can start my server from putty (SSH) but when I close it the game server closes as well.

The dedicated server is not in my house and I wanted to know a way to keep it running without having putty open. I tried to search on the forums but I have no clue how the term is called for that.

Any help would be great.

Thanks
Reply
#2
With this:

http://www.cyberciti.biz/tips/linux-screen-command-howto.html

http://www.linux.com/feature/56443

http://linuxreviews.org/man/screen/ (probably best for you)
Reply
#3
Excellent, thanks for the quick reply, will try it out right now!
Reply
#4
#!/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

Put that into a .sh file preferably server.sh
then all you have to do is run the .sh (./server.sh)

*note: fill in with your game
Reply
#5
Ok, heres the noob friendly answer.

You need to install a program called screen. Essentially what it does is keep whatever you had open in that SSH window running in a virtual screen (hence the name).

You will have to install as most dedi-boxes i have come across don't have it, but its easy.

if its ubuntu or debian:
apt-get install screen

if its RHEL, CentOS or similar:
yum install screen

then all you will need to do is type in screen, hit enter THEN run your server. To bring up your server again, just use screen -r in SSH and it will bring you back to the window you left open. If you run multiple screen windows it will just list numbers when you hit -r, so just for example do screen -r 3345 (imagining 3345 was one of those numbers).

Although the above post to put in a .sh text file would work much better.
Reply
#6
Thanks Skyride. Much better explained for a real noob Smile
Reply
#7
I got it working but now if I need to restart the server how would I do this. I looked online but I am uncertain as to how to stop the screen command to restart my game server.

I know I need to get a game panel setup. I'm looking at swiftpanel currently. Until then what would be the command to stop the server?
Reply
#8
To start it without screen just put the command you use to startup in a .sh file you wont be able to see whats in it but you can still close putty and have the server running. To kill the server, kill the .bin and the srcds process listed in ps -ax ( i think been a while since i used linux)
[Image: b_350x20_C002748-004880-FFFFFF-000000.png]
Reply
#9
Sorry I am very new to linux, you lost me pengy Sad
Reply
#10
Log into the account the server is running on and do screen -r to resume the screen session, then you can just control + c to kill the screen and server. Otherwise you can use ps -aux to list all the running processes and look for the screen and get it's UID, then just do eg: kill 2342
Reply
#11
You may find it useful to create scripts so you're not typing (or hitting up + enter) all the time.

SSH into your server and type in:

nano server_start.sh (if nano isn't installed then pico server_start.sh)

Edit this as needed and paste it into nano (right-click usually pastes):

Code:
#!/bin/sh
cd /path/to/srcds_run (replace this with your path, e.g. ~/srcds_l/orangebox)
screen -a -m -d -S srcds ./srcds_run -console -game tf(rest of your server command line goes here)

Once you've pasted it into nano, hit ctrl+o then enter to save the file, followed by ctrl+x to exit.

Make a second file called server_restart.sh (nano server_restart.sh). Edit this appropriately and paste it into nano:

Code:
#!/bin/sh
cd /path/to/server_start.sh (replace this with your path, e.g. ~/srcds_l/)
ps ax | grep '[s]rcds_run' | awk '{print $1}' | xargs kill
./server_start.sh

Once you've pasted it into nano, hit ctrl+o then enter to save the file, followed by ctrl+x to exit.

Finally, tell Linux it's ok to run these files:

chmod +x server_start.sh
chmod +x server_restart.sh

And you're done.

Now you can change to the directory you saved them in:

cd /path/to/scripts (e.g. ~/srcds_l)

and start/restart the server:

./server_start.sh
knoid || Admin, joe.to gaming community
tf2.joe.to - challenge maps
tf4.joe.to - custom maps
Reply
#12
Thanks guys! I did what you told me plus I added swiftpanel and everything is working top notch now.
[Image: b_350x20_C692108-381007-FFFFFF-000000.png]
[Image: b_350x20_C692108-381007-FFFFFF-000000.png]
Founder - http://www.wearenoobz.com - A TF2 Community
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)