Jump to content

Restart not working


maxdachs

Recommended Posts

Hello,

 

I tried to add this line with crontab -e on my server

 

0 0,4,8,12,16,20 * * * /home/arma2oa/restarter.pl
 
and then I also tried
0 0,4,8,12,16,20 * * * cd / && /home/arma2oa/restarter.pl

 

But the server does not restart.

 

My path in restarter.pl is:

use constant PATH      => $ENV{'PWD'}.'/'; # Set your epoch server dir

With this I can restart the server manually

But when I change the path in restarter.pl

to this: /home/arma2oa/ (the path where all files are), it says:

Can't found server binary!
I hope someone can help me!
Link to comment
Share on other sites

What *nix do you have? The crontab entries sometime look a bit different.

 

# m h  dom mon dow   command

0 */4 * * * /home/dayzepoch/server1042/restarter.pl >> /home/dayzepoch/server1042/restart.log 2>&1

 

Log to a file like I do  so you can see if there are messages (like binary not found or something).

Or check your mails with 'mail' to see if you see the error messages there.

Link to comment
Share on other sites

I personally make sure I set to / first to stop binary errors 

 

Here is my one  currently set to 3 hour restarts

 

0 0,3,6,9,12,15,18,21 * * * cd / && /home/dayzservers/epochchernarus/restarter.pl  >> /home/dayzservers/epochchernarus/restart.log 2>&1

 

May I suggest you install webmin to your server if possible. It makes it easier to create cron jobs in my opinion 

 

W4DFlC1.png

Looks like that :)

Link to comment
Share on other sites

You just need to set a absolute path in your restarter, that's all (did oversee your restarter line in the OP).

 

restarter.pl:

###use constant PATH      => $ENV{'PWD'}.'/'; # Set your epoch server dir
use constant PATH      => '/home/dayzepoch/server1042/';

 

cron:

0 */4 * * * /home/dayzepoch/server1042/restarter.pl >> /home/dayzepoch/server1042/restart.log 2>&1

 

It's always a good idea to use absolute paths in my opinion.So you can execute a script independantly in which directory your user currently is.

 

 

@DeanReid: I guess the root user in your screen was just an example? ;)

Link to comment
Share on other sites

You just need to set a absolute path in your restarter, that's all (did oversee your restarter line in the OP).

 

restarter.pl:

###use constant PATH      => $ENV{'PWD'}.'/'; # Set your epoch server dir

use constant PATH      => '/home/dayzepoch/server1042/';

 

cron:

0 */4 * * * /home/dayzepoch/server1042/restarter.pl >> /home/dayzepoch/server1042/restart.log 2>&1

 

It's always a good idea to use absolute paths in my opinion.So you can execute a script independantly in which directory your user currently is.

 

 

@DeanReid: I guess the root user in your screen was just an example? ;)

Nice, Thank you!  :)

Link to comment
Share on other sites

cron:

* * * * * /path/to/check_server_running.sh

 

check_server_running.sh:

 

somethine like:

if [ ps aux | grep epoch == 0 ]

./restarter.pl

fi

 

(pseudo code only).

 

Cron will check each minute if the process is still running. If not execute restarter,pl.

Link to comment
Share on other sites

  • 10 months later...

I tried to set the path in restarter.pl to an absolute path, but it keeps still saying "Can't found server binary!"

 

If I run it via "./restarter.pl" in console. I set up a cron Job, but I coundl't chek it for now if its working.

 

any hints where this problem can be solved ?

If i start my serevr with "./epoch.sh" it runs fine.

So whats the difference between epoch.sh and restarter.pl ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...