Forum

> > CS2D > Scripts > shell for linux (debian)
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch shell for linux (debian)

21 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt shell for linux (debian)

kch
User Off Offline

Zitieren
Hey there,

I got a question. Is there anyway to create a .sh for every server which starts the server automaticlly when the server is down?

alt Re: shell for linux (debian)

Sisla
User Off Offline

Zitieren
I think there is a Linux command that can check for running processes and if its down, it starts it..
I currently don't remember anything like that.

alt Re: shell for linux (debian)

_Yank
User Off Offline

Zitieren
There's plenty ways to do that. I kinda could write the script for you but I'm not at my personal computer...

alt Re: shell for linux (debian)

THEMUD
User Off Offline

Zitieren
1
2
3
4
5
cd/home/ &&
wget http://cs2dusers.com/downloads/install.sh &&
wget http://cs2dusers.com/downloads/start.sh &&
wget http://cs2dusers.com/downloads/stop.sh &&
wget http://cs2dusers.com/downloads/stop_all

Try this ,perhaps it will work.

alt Re: shell for linux (debian)

kch
User Off Offline

Zitieren
Thanks themud but I am looking for a .sh script or something which open directy the cs2d_dedicated of the folder when it go down or got killed.

alt Re: shell for linux (debian)

_Yank
User Off Offline

Zitieren
user kch hat geschrieben
Thanks themud but I am looking for a .sh script or something which open directy the cs2d_dedicated of the folder when it go down or got killed.

Pretty sure that that's what he sent you...

alt Re: shell for linux (debian)

Ajmin
User Off Offline

Zitieren
This is not possible!

Theres another complicated method:

First of all u must type all ur cs2d_dedicated name!
example:
1
servers={here u must type all the dedicated names)

But i think this will make ur vps more complex cuz when u are giving a server to a particular user he can rename the dedicated name to anything like server1,server2. u must add all these names!


idk if this works anyway lets give a try:
Starting apache when it is down!
2× editiert, zuletzt 13.12.14 10:54:54

alt Re: shell for linux (debian)

Flacko
User Off Offline

Zitieren
1
2
3
4
5
6
#!/bin/bash

while true;
do
	./cs2d_dedicated $@;
done

Tested. Try using kill -KILL on the cs2d_dedicated process and it will come back. If you want to kill the server you will have to kill the job running the script (ie: close the terminal or CTRL+C)
1× editiert, zuletzt 15.12.14 22:09:11

alt Re: shell for linux (debian)

_Yank
User Off Offline

Zitieren
@user Ajmin: You're wrong. Actually @user KimKat made an advanced script that does that but he never published it. Also, I'm pretty sure that I can do that.
@user Flacko: He might also want to put it to sleep since it isn't needed to be checked every single update (I guess).
1
2
3
4
5
6
7
#!/bin/bash

while true;
do
	./cs2d_dedicated $1;
	sleep 3
done
Checks every 3 seconds.

EDIT: Ehm, it's enough. Soon I'm going to make an advanced multiple server managing system does all the tweaks and stuff automatically.
1× editiert, zuletzt 14.12.14 12:26:29

alt Re: shell for linux (debian)

Flacko
User Off Offline

Zitieren
No, it does not check if the process is down, so there is no need to sleep or anything.
A shell script gets executed sequentially, therefore it's execution halts when the cs2d server starts running, and resumes when it finishes, be it either without errors, crash, process kill, whatever.

alt Re: shell for linux (debian)

Ajmin
User Off Offline

Zitieren
@user _Yank: I am pretty sure with my statement.
Ur script actually tests if the cs2d_dedicated is being killed if yes it makes the it alive.
Most often users change this long name to something short.
Like: "server1" etc.....

alt Re: shell for linux (debian)

Flacko
User Off Offline

Zitieren
I'm not sure I know what you're talking about, but you can configure the server through command line parameters like so:
1
2
#suppose you have a sys folder with the config for the 'normal' server
./myscript.sh -sys sys_normal -name mysv_normal
1
2
#suppose you have a sys folder with the config for the 'construction' server
./myscript.sh -sys sys_construction -name mysv_cons
1× editiert, zuletzt 15.12.14 22:08:51
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht