English How open the CS2D server on Ubuntu?

13 replies
Goto Page
To the start Previous 1 Next To the start
Up
sheeL
User
Offline Off
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.
28.12.13 10:32:37 pm
Up
Rocik
User
Offline Off
cd <path>
chmod 775 cs2d_dedicated // Only once
./cs2d_dedicated
28.12.13 10:52:27 pm
Up
sheeL
User
Offline Off
user Rocik has written:
cd <path>
chmod 775 cs2d_dedicated // Only once
./cs2d_dedicated


Thank you.
Is there any way to restart the server when it crashes?
28.12.13 11:20:10 pm
Up
VaiN
User
Offline Off
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.
28.12.13 11:25:35 pm
Up
sheeL
User
Offline Off
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
29.12.13 02:47:16 am
Up
VaiN
User
Offline Off
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
Code:
1
sudo apt-get install screen


then you can run the server using screen:
Code:
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:
Code:
1
screen -list


to end a process:
Code:
1
screen kill sv_name

or
Code:
1
screen kill pid

replacing "pid" with the process id returned from screen -list

for other uses of screen:
Code:
1
man screen

to view the manual
29.12.13 03:32:12 am
Up
sheeL
User
Offline Off
Thanks @@user VaiN: ;
If the server goes down, screen automatically open the server?
29.12.13 03:42:29 am
Up
DannyDeth
User
Offline Off
@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.
29.12.13 04:12:28 am
Up
VaiN
User
Offline Off
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.
29.12.13 08:45:54 am
Up
ohaz
User
Offline Off
Easiest way to check if the server is running is by using a crontab and a script:
script:
Code:
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
Code:
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
https://ohaz.engineer - Software Engineering
29.12.13 11:28:25 am
Up
_Yank
User
Offline Off
Also id recommend to use this : http://deflate.medialayer.com
It tries to prevent your server of being attacked.
29.12.13 10:03:40 pm
Up
sheeL
User
Offline Off
user _Yank has written:
Also id recommend to use this : http://deflate.medialayer.com
It tries to prevent your server of being attacked.


Thanks @user ohaz: @user VaiN: @user _Yank:

--

I'm getting some problems with it
Print : http://prntscr.com/2f1878
edited 3×, last 30.12.13 03:26:57 am
30.12.13 03:44:18 am
Up
VaiN
User
Offline Off
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:
Code:
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
30.12.13 04:21:19 am
Up
sheeL
User
Offline Off
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
Code:
1
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html


Code:
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