Forum

> > CS2D > Servers > How open the CS2D server on Ubuntu?
ForenübersichtCS2D-Übersicht Servers-ÜbersichtEinloggen, um zu antworten

Englisch How open the CS2D server on Ubuntu?

13 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How open the CS2D server on Ubuntu?

sheeL
User Off Offline

Zitieren
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.

alt Re: How open the CS2D server on Ubuntu?

sheeL
User Off Offline

Zitieren
user VaiN hat geschrieben
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
1× editiert, zuletzt 29.12.13 01:52:21

alt Re: How open the CS2D server on Ubuntu?

VaiN
User Off Offline

Zitieren
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

alt Re: How open the CS2D server on Ubuntu?

DannyDeth
User Off Offline

Zitieren
@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.

alt Re: How open the CS2D server on Ubuntu?

VaiN
User Off Offline

Zitieren
user sheeL hat geschrieben
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.

alt Re: How open the CS2D server on Ubuntu?

ohaz
User Off Offline

Zitieren
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.
1× editiert, zuletzt 29.12.13 09:17:58

alt Re: How open the CS2D server on Ubuntu?

VaiN
User Off Offline

Zitieren
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

alt Re: How open the CS2D server on Ubuntu?

sheeL
User Off Offline

Zitieren
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
4× editiert, zuletzt 31.12.13 05:18:42
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Servers-ÜbersichtCS2D-ÜbersichtForenübersicht