English [SOLVED]Reopen closed/crashed server auto

6 replies
Goto Page
To the start Previous 1 Next To the start
Up
ReVoltage
User
Offline Off
Hello us ,
I have a problem with my server this time.
I dont know if it my VPS problem or the server problem.
Is there anyway to automatic turn on the server when its offline? Is this possible?
Im using linux for hosting, maybe there is a way to do this with command or something?
Because im tired of my server crashed again and again.
I hope linux master are here
Thanks before..
edited 1×, last 15.12.13 07:46:09 am
13.12.13 05:58:51 pm
Up
tonton2d
User
Offline Off
it can be done with an automatic shell (crontab) which check if cs2d is still in the processus list.
"Akounamatata"
13.12.13 06:37:27 pm
Up
ohaz
User
Offline Off
exactly, a crontab is what you want to set up ( http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5 )
https://ohaz.engineer - Software Engineering
14.12.13 06:46:09 am
Up
ReVoltage
User
Offline Off
Uhh.. I just do some searching in google.
But how to detect cs2d_dedicated process and run cs2d_dedicated again if it not open automatic?
Can someone give me and code example for this?

EDIT: now i found this code to check if it running or not.
Code:
1
2
3
4
5
6
ps cax | grep cs2d_dedicated > /dev/null
if [ $? -eq 0 ]; then
  echo "Running."
else
  echo "Not running."
fi

I just test the code and its work, but how to run it with contrab (scheduled) and run cs2d_dedicated if its return "Not running"?

EDIT2: While waiting for the answer, I have try a way to do this.
I make .sh file in root, that file contain code to check if cs2d_dedicated is working or not, if it not then it will turn it on.
Then i make contrab every 5 minutes to run the .sh file.
So would this work properly as I want or not?

EDIT3: I just convert DOS file to UNIX file and its work. Problem solved by myself
Big thanks to user ohaz and user tonton2d
edited 3×, last 15.12.13 07:45:52 am
22.06.14 06:02:04 pm
Up
lennon
User
Offline Off
i try to make autorestart with this


Code:
1
2
3
4
5
6
7
ps cax | grep cs2d_dedicated > /dev/null
if [ $? -eq 0 ]; then
  echo "Running."
else
  echo "Not running." 
if [echo "Not running."; then
nohup /home/cs2d/cs2d_dedicated > /dev/null 2>&1 &


but dont work, anybody have ideas?
The game of year - CS2D
22.06.14 08:24:51 pm
Up
sheeL
User
Offline Off
I have a cron for restart CS2D when crash.
But isn't much simple, have 67 lines, i am selling it for $10
22.06.14 10:47:23 pm
Up
lennon
User
Offline Off
do u know that idea is free ?
The game of year - CS2D
To the start Previous 1 Next To the start