Jump to content

Restart script tied to time since last server start?


ObamaCare

Recommended Posts

Sorry if the title sounds confusing, but does anybody know of a way to run restarts based on when the server was last started? For example, I want to run restarts every 4 hours, I start my server at 0:00, but at 1:00 I do a manual restart because I changed something, is there a way to now make the server restart at 5:00 instead of 4:00 as scheduled?

Link to comment
Share on other sites

I have the same problem but did not had the time to really think about it. I warn my users via the battleye restarts script from this forum which is accurate (if scheduled via cron) to the restart time of cron (so system time).

My debug monitor has this normal function to calculate the restart time which can be found everywhere but that is not accurate anymore if you restart manually between 2 automatic restarts by cron.

 

I think you could also do the restarts completely from the game if you determine somewhere in a script how long the mission is already running and if it's time to restart (or for warnings) you write something to the diag_log what could be parsed by writer.pl to execute restarter.pl which then actually does the restart. Something like that as an idea.

 

Devd wrote somewhere in another post that he would do it via the game but he did not really explain how. But that's something on my list to think about.

Link to comment
Share on other sites

Hm, I don't know if a player which loads the mission file can determine how long the mission is already running. Maybe that needs to be done serverside...but maybe somewone else knows better how that works. It was just an vague idea. I did not try anything here so far.

Link to comment
Share on other sites

Okay, thanks, so I have a countdown timer on my Debug Menu until restarts, so would I add a custom script, and have it check for a certain uptime, then when that time is reached, it executes restarter.pl?

 

Hm, I don't know if a player which loads the mission file can determine how long the mission is already running. Maybe that needs to be done serverside...but maybe somewone else knows better how that works. It was just an vague idea. I did not try anything here so far.

 

 

The Mission uptime is calculated when The mission is first loaded (Server Start usually or 1 or 2 minutes after), I don't believe it is calculated when the user joins, so It could work the way you mentioned Could be wrong though, The only problem I see with that is if your mission file is huge and takes a long time to load then that could become a problem, Best thing you could check out is restart the server, Join and see how long you are stuck on the map/lobby for and how long until you can actually play 

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