Forum

> > CS2D > Scripts > shell for linux (debian)
Forums overviewCS2D overview Scripts overviewLog in to reply

English shell for linux (debian)

21 replies
Page
To the start Previous 1 2 Next To the start

old shell for linux (debian)

kch
User Off Offline

Quote
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?

old Re: shell for linux (debian)

Sisla
User Off Offline

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

old Re: shell for linux (debian)

_Yank
User Off Offline

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

old Re: shell for linux (debian)

THEMUD
User Off Offline

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

old Re: shell for linux (debian)

kch
User Off Offline

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

old Re: shell for linux (debian)

_Yank
User Off Offline

Quote
user kch has written
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...

old Re: shell for linux (debian)

Ajmin
User Off Offline

Quote
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!
edited 2×, last 13.12.14 10:54:54 am

old Re: shell for linux (debian)

Flacko
User Off Offline

Quote
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)
edited 1×, last 15.12.14 10:09:11 pm

old Re: shell for linux (debian)

_Yank
User Off Offline

Quote
@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.
edited 1×, last 14.12.14 12:26:29 pm

old Re: shell for linux (debian)

Flacko
User Off Offline

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

old Re: shell for linux (debian)

Ajmin
User Off Offline

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

old Re: shell for linux (debian)

Flacko
User Off Offline

Quote
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
edited 1×, last 15.12.14 10:08:51 pm
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview