Jump to content
Shelby

Automatic restart messages w/out BEC (need help)

Recommended Posts

So I have got a bit of a weird problem.
I'm hosting a dayz epoch panthera server on a linux root.
As I can't run BEC on linux and there are no good alternatives, I solved most of my problems with scripting solutions.
 
I want my server to restart every 4 hours, so I set up crontab (whitch is a linux service for running timed tasks).
For my players to be warned that the server is going to restart, I have a script to warn them.

 

private ["_mainTextColour","_subTextColour","_hint"];diag_log(format ["DEBUG RESTART MESSAGE || inizializing || %1",round(time)]);_subTextColour = "#FF0000";_mainTextColour = "#4BC9B0";//1 hour beforewaituntil {(round(time)) > 10799};diag_log(format ["DEBUG RESTART MESSAGE || waituntil || %1",round(time)]);if (time > 10799) then {diag_log(format ["DEBUG RESTART MESSAGE||inside if2 no round|| %1",time]);_hint = parseText format ["Server Reboot---------------------------------In 1 Hour", _mainTextColour, _subTextColour];[nil,nil,rHINT,_hint] call RE;};//30 mins beforewaituntil {(round(time)) > 12599};diag_log(format ["DEBUG RESTART MESSAGE || waituntil || %1",round(time)]);if (time > 12599) then {diag_log(format ["DEBUG RESTART MESSAGE||inside if2 no round|| %1",time]);_hint = parseText format ["Server Reboot---------------------------------In 30 Mins", _mainTextColour, _subTextColour];[nil,nil,rHINT,_hint] call RE;};//5 mins beforewaituntil {(round(time)) > 14099};diag_log(format ["DEBUG RESTART MESSAGE || waituntil || %1",round(time)]);if (time > 14099) then {diag_log(format ["DEBUG RESTART MESSAGE||inside if2 no round|| %1",time]);_hint = parseText format ["Server Reboot---------------------------------In 5 Mins", _mainTextColour, _subTextColour];[nil,nil,rHINT,_hint] call RE;};//1 min beforewaituntil {(round(time)) > 14339};diag_log(format ["DEBUG RESTART MESSAGE || waituntil || %1",round(time)]);if (time > 14339) then {diag_log(format ["DEBUG RESTART MESSAGE||inside if2 no round|| %1",time]);_hint = parseText format ["Server Reboot---------------------------------In 1 Min", _mainTextColour, _subTextColour];[nil,nil,rHINT,_hint] call RE;};

 

 

The problem is that my server isn't very populated and sometimes after a restart the mission only loads after an hour or so, so that the clock for the restart message only starts an hour delayed, resulting in the warnings failing.

 

Does anybody know a solution to this? Is there a way to get the exact time of the server? Or a way to load the mission right after a restart?

 

Thanks in advance...

 

//Also, first post, hope this is the right place to post this

Share this post


Link to post
Share on other sites

Hello there an dwelcome to the forums,

 

I have never tried it myself, but have you tried serverTime instead of time? I know time isn't synced properly across Clients anyway, making your way of doing it faulty.

 

You can, by the way, run BEC externally. If you have a less powerful windows server somewhere or if your homecomputer is running all the time you should be able to execute and connect with BEC from somewhere else, it doesn't have to be locally.

Share this post


Link to post
Share on other sites

Thank you for your response.

I don't have a windows server or a pc that's always running, so I tried serverTime, which seemed to return every restart warning at once.

 2:37:43 "DEBUG RESTART MESSAGE || inizializing || 991725" 2:37:43 "DEBUG RESTART MESSAGE || DEBUG1 || 991725" 2:37:43 "DEBUG RESTART MESSAGE || waituntil || 991725" 2:37:43 "DEBUG RESTART MESSAGE||inside if2 no round|| 991725" 2:37:43 Wrong color format 2:37:43 "DEBUG RESTART MESSAGE || waituntil || 991725" 2:37:43 "DEBUG RESTART MESSAGE||inside if2 no round|| 991725" 2:37:43 Wrong color format 2:37:43 "DEBUG RESTART MESSAGE || waituntil || 991725" 2:37:43 "DEBUG RESTART MESSAGE||inside if2 no round|| 991725" 2:37:43 Wrong color format 2:37:43 "DEBUG RESTART MESSAGE || waituntil || 991725" 2:37:43 "DEBUG RESTART MESSAGE||inside if2 no round|| 991725"

Instead I switched to diag_ticktime which also didn't work, because it didn't do anything at all regardless how small I set the time in the if-condition.

 

So yeaaaah...

Share this post


Link to post
Share on other sites

Thank you for your response.

I don't have a windows server or a pc that's always running, so I tried serverTime, which seemed to return every restart warning at once.

 

Instead I switched to diag_ticktime which also didn't work, because it didn't do anything at all regardless how small I set the time in the if-condition.

 

 

diag_ticktime is used in the DayZ Code and should work. It only starts with the missionstart, though. But it should be synced properly. Try values about 300 / 5 minutes after restart.

 

Anyway - I have personally never used it for these kind of things, as the serverTime and all other times have syncissues, which is why you'll most likely not be able to get it working properly.

 

One thing you can do however (which is the only thing I can think of) is to send out the message that the server restarts at given times (i.e. 4, 8, 12, 16) and that they should be prepared for that.

 

That's the only thing I would know would work, but other than that I think it's hard to accomplish, if not impossible due to the syncissues.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×