Forum

> > CS2D > Servers > How open the CS2D server on Ubuntu?
Forums overviewCS2D overview Servers overviewLog in to reply

English How open the CS2D server on Ubuntu?

13 replies
To the start Previous 1 Next To the start

old How open the CS2D server on Ubuntu?

sheeL
User Off Offline

Quote
Hello,

Get CS2D Linux √
Get the windows client zip archive √
Extract both to the same folder √
Start server ×

I'm newbie in Linux, what is the cmd for start the server?

Thanks.

old Re: How open the CS2D server on Ubuntu?

sheeL
User Off Offline

Quote
user VaiN has written
press Control+C to stop a process that is running in the terminal.
press up arrow to get the last command you typed and press enter.

This will not restart the server automatically

I have the C-4 script, and i go try open the server again.
--

@edit : When i close the ssh, the server close again
edited 1×, last 29.12.13 01:52:21 am

old Re: How open the CS2D server on Ubuntu?

VaiN
User Off Offline

Quote
you asked how to restart the server, and that's what I told you.

what you are wanting is to run the server in the background.
there's a couple of options for that, but a simple solution is to use screen
1
sudo apt-get install screen

then you can run the server using screen:
1
screen -dmS sv_name /path/to/cs2d/directory/cs2d_dedicated
obviously, replace the path with where your cs2d is installed, you can make "sv_name" whatever you want to name the process in screen

to view a list of running screen processes:
1
screen -list

to end a process:
1
screen kill sv_name
or
1
screen kill pid
replacing "pid" with the process id returned from screen -list

for other uses of screen:
1
man screen
to view the manual

old Re: How open the CS2D server on Ubuntu?

DannyDeth
User Off Offline

Quote
@user sheeL: It is best that you learn to actually use Linux than just copy and paste bits and pieces from websites. Screen is a utility used to access several virtual terminals with a single TTY. It happenstances to be useful in this case, RTFM is a good idea. Learn to use the 'man' command and all your problems will disappear.

old Re: How open the CS2D server on Ubuntu?

VaiN
User Off Offline

Quote
user sheeL has written
Thanks @@user VaiN: ;
If the server goes down, screen automatically open the server?


no. the only way to automatically restart a crashed server is to create a script that checks the server status on an interval and stops/starts the server as needed.

This would be too complex for me to explain here.

old Re: How open the CS2D server on Ubuntu?

ohaz
User Off Offline

Quote
Easiest way to check if the server is running is by using a crontab and a script:
script:
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash

PIDFILE="$HOME/tmp/cs2d_dedicated.pid"

if [ -e "${PIDFILE}" ] && (ps -u $USER -f | grep "[ ]$(cat ${PIDFILE})[ ]"); then
  echo "Already running."
  exit 99
fi

$HOME/cs2d/cs2d_dedicated & > $HOME/tmp/cs2d_dedicated.log &

echo $! > "${PIDFILE}"
chmod 644 "${PIDFILE}"
Put this script somewhere in your home folder or inside the cs2d_dedicated folder and call it cs2d_starter
Then you just have to add a crontab line. To do that, enter
crontab -e
and add
1
* * * * * /home/cs2duser/cs2d/cs2d_starter
Of course you have to replace the path with the path your cs2d script is in.
This leads to the script above being executed every minute. The script then tests if the cs2d server is running, and, if not, is starting it.
edited 1×, last 29.12.13 09:17:58 am

old Re: How open the CS2D server on Ubuntu?

VaiN
User Off Offline

Quote
I'd really like to emphasize that you should learn more about linux before hosting.

It's highly recommended to not use the 'root' user.
You should be looking up info about commands before using them:
1
man crontab
there are far better places suited for linux support than this forum, and a simple web search will yeild many helpful results

old Re: How open the CS2D server on Ubuntu?

sheeL
User Off Offline

Quote
I have a hosting company, with OS windows, now i go try learn about Linux.

I've researched a lot on Google, but the information meeting will not help me, i know how add crontab, my problem that the commands do not correspond to my goal

--

@user ohaz: your code is getting for me a warning
1
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash

PIDFILE=/home/CS2D/cs2d_dedicated.pid"

if [ -e "${PIDFILE}" ] && (ps -u $USER -f | grep "[ ]$(cat ${PIDFILE})[ ]"); then
  echo "Servidor online."
  exit 99
fi

/home/CS2D/cs2d_dedicated & > /home/CS2D/cs2d_dedicated.log &

echo $! > "${PIDFILE}"
chmod 644 "${PIDFILE}"

PS = Your code is creating other servers
Print : http://prntscr.com/2fbxd4
edited 4×, last 31.12.13 05:18:42 am
To the start Previous 1 Next To the start
Log in to reply Servers overviewCS2D overviewForums overview