IT07

[Release] [scarCODE] automated restart warnings

56 posts in this topic

Advertisement

Question, so if I'm using a scheduled task on my server to restart it currently should I disable that if using this?

Share this post


Link to post
Share on other sites

Posted (edited)

Very nice. A much needed feature.

*Edit* If this is run client side, how does it know how much time is left until restart? Does it read the amount of time the server has been up and then calculates the time left based on that? Obviously since my status bar shows the time until restart and that is client side, I assume that's how it works?

*Edit 2* I have a scroll menu option to "Do restart warning" and it says "99 minutes until restart". How do I get rid of that? Was that a debug used during testing? At the time I selected that option the server had 3 hours and 45 minutes until restart BTW.

Edited by BetterDeadThanZed

Share this post


Link to post
Share on other sites
33 minutes ago, BetterDeadThanZed said:

Very nice. A much needed feature.

*Edit* If this is run client side, how does it know how much time is left until restart? Does it read the amount of time the server has been up and then calculates the time left based on that? Obviously since my status bar shows the time until restart and that is client side, I assume that's how it works?

you set it to whatever you want within the config.cpp, the status bar script has a similar setting within its files so I'm assuming you just got lucky and have your restarts set to the default time put in the statusbar script.

so for the settings below in the config.cpp you would set which mode you want, dynamic or schedule.  dynamic interval would equal the amount of hours the server would be up before it restarts. ( if you restart every 3 hours, interval would be 3)  if you use the scheduled restarts that would restart the server at those specific hours (in the example he has it restarting every hour, obviously you would want to delete the hours you didn't want it to restart)

Spoiler

 class dynamic
   {
      interval = 1; // after how many hours of uptime the server will restart | ignore if using scheduled restarts
   };
   class scheduled
   {
      schedule[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}; // hours at which the server will restart | ignore if using non-scheduled restarts
   };
   forceLeave = 1; // (in minutes) | kicks players to lobby if still in-game at this amount of minutes before restart | use 0 to disable
   giveWarningsAt[] = {60,50,40,30,20,10,5,2,1}; // higher numbers before lower
mode = 2; // 1 = non-scheduled | 2 = scheduled

 

 

Share this post


Link to post
Share on other sites
6 minutes ago, Zombie Pacifier said:

you set it to whatever you want within the config.cpp, the status bar script has a similar setting within its files so I'm assuming you just got lucky and have your restarts set to the default time put in the statusbar script.

so for the settings below in the config.cpp you would set which mode you want, dynamic or schedule.  dynamic interval would equal the amount of hours the server would be up before it restarts. ( if you restart every 3 hours, interval would be 3)  if you use the scheduled restarts that would restart the server at those specific hours (in the example he has it restarting every hour, obviously you would want to delete the hours you didn't want it to restart)

I'm sure I set the restart time in the status bar to 4 hours. I didn't "get lucky". I understand the settings. They are well documented. My question, which maybe IT07 can answer, is how does this calculate the amount of time left until restart? 

Share this post


Link to post
Share on other sites

UPDATE! (June 20th, 2016)
Check the CHANGELOG.md for details

@BetterDeadThanZed The calculation for the dynamic restarts is very easy: convert the interval (3 for example) to seconds and then take away the serverTime (https://community.bistudio.com/wiki/serverTime) from it. And then I run a loop that waits for the result to become lower or equal to one of the warning times given in the config.

Then there is the calculation for the scheduled restarts which is a little bit more complicated:
1. let the server broadcast its own missionStart value and use that on the client
2. find the hour that will be the first upcoming one in schedule
3. convert that hour into seconds and take away the server's start hour, minute and seconds from it.
4. then you have the amount of seconds the server will be up before the next restart hour.
5. take away the serverTime from it and tadaaaa you have the right number to show to the player.

2 people like this

Share this post


Link to post
Share on other sites

i have had this running on my server for about a couple weeks now and it runs perfectly. haven't seen any bugs since!

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.