Jump to content

Insane Limits: Automatic server restart


ImportBot

Recommended Posts

Originally Posted by PapaCharlie9*:

 

Per NFO about R35, DICE recommends restarting your server every 24 to 48 hours:

 

Update @ 10:25am PDT: DICE has told us that this new version has performance that degrades over time even more quickly than the last one, and advises restarting servers every 24-48 hours. We already restart servers daily when they empty out, but if you have a server that is very busy and never empties, you may need to manually restart it or schedule extra automatic restarts.

 

 

 

Papa, is it possible to have a limit restart the server with a warning message at a specific time each day (regardless of player count and even if I have ProCon automatically restarted daily or the server crashed/restarted earlier)?

 

If possible, would you please create a limit for us that does the following:

 

1) Restarts the server at approximately 3PM each day,

2) Forces the restart to happen on the onLoadLevel event (start of next round),

3) Gives the following message, three times consecutively with each time occurring every 15 seconds, in both SAY and a 15 second YELL to everyone during the intermission:

 

Server RESTARTING NOW to BOOST Gameplay Performance!

Please REJOIN IN 1 MINUTE to Play on a Fresh Server.

 

 

For example:

Round Ends and 1st message sent as SAY with 15 second YELL.

15 seconds later, 2nd message sent as SAY with 15 second YELL.

15 seconds later, 3rd message sent as SAY with 15 second YELL.

 

If you want me to copy this request to the IL requests thread, please let me know.

Insane Limits doesn't expose the OnLevelLoaded event, so that can't be done. Instead, a restart can be done a certain number of seconds after OnRoundOver, which is almost as good. That is what is done below.

 

Also, are chat and yell messages visible after a round ends, for that long? I know chat is visible for a while, but I didn't think it was 45 seconds, and I don't think yells are visible at all. I'll create the limit as specified, but I'm not sure it will work as expected. Also a 15 second yell every 15 seconds three times is the same as one 45 second yell. :smile:

 

I'll also include a limit to restart the server when it is empty on an off hour, like 3am. The 3pm limit will only execute if the 3am limit did not. Actually, since both limits are based on actual server uptime, they won't run if any kind of restart has happened within the specified period, so you don't have to worry about too many restarts. These limits are like restarts of last resort.

 

First, the empty server restart limit.

 

Create a limit OnIntervalServer, set interval to 300, call it "Restart when empty".

 

Set first_check to this Code:

 

Code:

int Hour24Clock = 3; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM

if (server.PlayerCount != 0)
    return false;

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    plugin.ConsoleWrite("^1AUTOMATIC RESTART OF EMPTY SERVER");
    plugin.PRoConEvent("AUTOMATIC RESTART OF EMPTY SERVER", "Insane Limits");
    plugin.ServerCommand("admin.shutDown");
}
return false;
Change the value of Hour24Clock to be the hour of the day you want to check if the server is empty and restart automatically. It will check for the whole hour, so if at 03:05 there are 4 players it will do nothing, but if at 03:25 there are no players, it will restart the server. It checks every 5 minutes. If there is at least 1 player from 03:00 to 03:59, nothing will happen.

 

Limit to restart the server a specified number of seconds after the first RoundOver in a specified hour, even if the server is not empty.

 

Create a limit to evaluate OnRoundOver, call it "Server Restart With Warnings".

 

Set first_check to this Code:

 

Code:

int Hour24Clock = 15;  // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
int DelaySeconds = 45; // CHANGE: Number of seconds after RoundOver to do the restart
String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
int YellDuration = 15; // CHANGE

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    Thread messenger = new Thread(new ThreadStart(delegate {
        try {
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
        } catch (Exception) {}
    }));
    messenger.Name = "RestartMessenger";
    messenger.Start();

    Thread timer = new Thread(new ThreadStart(delegate {
        try {
            Thread.Sleep(DelaySeconds * 1000);
            plugin.ConsoleWrite("^1AUTOMATIC RESTART OF ACTIVE SERVER");
            plugin.PRoConEvent("AUTOMATIC RESTART OF ACTIVE SERVER", "Insane Limits");
            plugin.ServerCommand("admin.shutDown");
        } catch (Exception) {}
    }));
    timer.Name = "AutoRestarter";
    timer.Start();
}

return false;
Change the value of Hour24Clock to be the hour of the day you want to check if the server has not been restarted earlier. It will check for the whole hour, so on the first RoundOver between, for example, 15:00 and 15:59, the server will be restarted, if it hadn't been restarted in the previous 24 hours.

 

Change the value of DelaySeconds to be the number of seconds after RoundOver to restart the server. Make sure your messages (see following) fit within the DelaySeconds time you specify. For example, if you set DelaySeconds to 30 seconds but have 45 seconds of messages, the last 15 seconds of messages will be lost.

 

Change the value of ChatMessage and YellMessage to be the chat and yell warnings to be sent after the round ends. Keep the message length to less than 128 characters and containing no { or } characters.

 

Change the value of YellDuration to be the number of seconds for the yell to be shown. Keep in mind that the messages are sent three times, once every 15 seconds.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by IAF-SDS*:

 

Very cool.

 

I chose three 15 second yells instead of one 45 second yell to make sure they see the yell, because sometimes if they get another yell from the server or if they even press the ESC key to change an option, they'll miss the yell if it was one 45 second yell; whereas three 15 second yells gives them 3 chances to see it. :ohmy: I'll have to test to confirm yells are visible during intermission (I believe they are) and for how long.

 

NFO restarts the server once every day if it is ever empty. So I probably don't need the first limit, although it probably wouldn't hurt. Either way, it's good for others who don't have such restarts from their provider.

 

I know if I stop the server from my control panel, I can then restart it and it will show up in battlelog with people joining in about a minute. Im not sure, however, how long it will take for the provider's system to restart the server after the admin.shutdown command is sent by the limit. Im a little worried that if the sever doesn't come back up in about a minute, many won't want to wait longer and might not come back. We'll have to try it to see.

 

I'll let you know how it works once I've had a chance to implement it.

 

Thank you Papa.

 

 

EDIT:

I confirmed that yell does not work during the intermission, but the repeated chat messages are sufficient to let people know. I also confirmed that my server restarts itself immediately after the limit sends the admin.shutdown and players were able to join the server in under a minute which is nice.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ColColonCleaner*:

 

Instead of 1 45 second yell it would probably be best to have that split into 9 5 second yells issued in succession. Still 45 seconds, remember a yell no matter how long will be overwritten by a new one coming through, so if you have a spambot or other thing going it will wipe the important yell off the screen.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Ok, ok, that's what I get for being a smartass. :smile: I wrote the code to do three X second yells anyway, where you get to pick X and the default is 15. I was just pointing out that, absent any of the interference you guys mentioned, it's going to look to players like one 45 second yell.

 

Personally I'd set X to 12 and have a 3 second beat in between. Things that change catch the eye more than things that are static.

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 months later...

Originally Posted by trans-am*:

 

First, the empty server restart limit.

 

Create a limit OnIntervalServer, set interval to 300, call it "Restart when empty".

 

Set first_check to this Code:

 

Code:

int Hour24Clock = 3; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM

if (server.PlayerCount != 0)
    return false;

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    plugin.ConsoleWrite("^1AUTOMATIC RESTART OF EMPTY SERVER");
    plugin.PRoConEvent("AUTOMATIC RESTART OF EMPTY SERVER", "Insane Limits");
    plugin.ServerCommand("admin.shutDown");
}
return false;
Change the value of Hour24Clock to be the hour of the day you want to check if the server is empty and restart automatically. It will check for the whole hour, so if at 03:05 there are 4 players it will do nothing, but if at 03:25 there are no players, it will restart the server. It checks every 5 minutes. If there is at least 1 player from 03:00 to 03:59, nothing will happen.
Is it possible to include these in?

 

1) Last 50 ticket left, the server will spam this message Code:

String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
for every 10 ticket pass? (yell for 5 sec) Reason for this is because BF3 doesn't support your the other code.

 

 

2) We are able to set the time range for server to restart.

Example: During 3am-5am, server checks every 5 minutes. If there is 0 player it will restart, else nothing will happen.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Is it possible to include these in?

 

1) Last 50 ticket left, the server will spam this message Code:

String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
for every 10 ticket pass? (yell for 5 sec) Reason for this is because BF3 doesn't support your the other code.
Which limit doesn't work on BF3? Both of the limits in post #1 should work fine on BF3.

 

You could create another limit to do the yelling/chatting. Just create a new limit "Warn Restart", OnKill. NOTE: This only works for count-down modes, like Conquest, Rush and Domination. Does not work for TDM.

 

Set first_check to this Code:

 

Code:

String key = "Last Tickets";
double min = Math.Min(server.RemainTickets(1), server.RemainTickets(2));
if (!server.RoundData.issetDouble(key))
    server.RoundData.setDouble(key, 50);
double last = server.RoundData.getDouble(key);
if (min <= last) {
    server.RoundData.setDouble(key, last - 10);
    return true;
}
return false;
Set Action to your chat and yell actions.

 

2) We are able to set the time range for server to restart.

Example: During 3am-5am, server checks every 5 minutes. If there is 0 player it will restart, else nothing will happen.

Use this updated first_check:

 

Code:

int Hour24Clock = 3;  // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
int LastHour24Clock = 5; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM

if (server.PlayerCount != 0)
    return false;

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour < LastHour24Clock && DateTime.Now.Hour >= Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    plugin.ConsoleWrite("^1AUTOMATIC RESTART OF EMPTY SERVER");
    plugin.PRoConEvent("AUTOMATIC RESTART OF EMPTY SERVER", "Insane Limits");
    plugin.ServerCommand("admin.shutDown");
}

return false;
Just make sure that Hour24Clock is LESS THAN LastHour24Clock.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by trans-am*:

 

Which limit doesn't work on BF3? Both of the limits in post #1 should work fine on BF3.

Your 2nd code?

From what i understand, after end of round, server will spam message & bf3 can't do that.

 

 

NOTE: This only works for count-down modes, like Conquest, Rush and Domination. Does not work for TDM.

How come not working on TDM? I need it on TDM

 

 

**************************************************

 

Request:

 

 

Is it possible to do this on BF3 TDM?

 

Use this updated first_check:

 

Code:

int Hour24Clock = 3;  // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
int LastHour24Clock = 5; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
+

Last 50 ticket left, the server will spam this message for every 10 ticket pass (yell for 5 sec)

Code:

String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
|

V

 

During 3 am - 5 am, Last 50 ticket left, the server will spam this message for every 10 ticket Drop (yell for 5 sec)(message will appear for 5 times) and it will restart the server even there are player. After the server restarted, it will stop spamming these message.

 

 

 

*******************************

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Your 2nd code?

From what i understand, after end of round, server will spam message & bf3 can't do that.

 

 

How come not working on TDM? I need it on TDM

 

 

**************************************************

 

Request:

 

 

Is it possible to do this on BF3 TDM?

 

 

 

+

Last 50 ticket left, the server will spam this message for every 10 ticket pass (yell for 5 sec)

Code:

String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
|

V

 

During 3 am - 5 am, Last 50 ticket left, the server will spam this message for every 10 ticket Drop (yell for 5 sec)(message will appear for 5 times) and it will restart the server even there are player. After the server restarted, it will stop spamming these message.

 

 

 

*******************************

Sorry, my mistake, it will work for TDM as written in post #7. I thought there was a problem in handling TDM because for that mode, tickets count up (from 0 to 100), while Conquest, etc., counts down (from 300 to 0). So when you ask for the "last 50 tickets", that's a different number for Conquest vs TDM. But Insane Limits already handles that with RemainTickets. So it's fine.

 

Also, the limit for the chats/yells is also in post #7. So everything you need is in post #7.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by trans-am*:

 

Sorry PapaCharlie9 can i request another limits on this? i clearly know what i want now

 

 

when the server reach the time for restart (example 3am), and there are people playing in the server, the server will restart even if there are player in it BUT It will restart only when the round has ended. During that round, server will spam " Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server " (Yell & say) for the last 50 ticket left (TDM), every 10 ticket Drop (yell for 5 sec)(message will appear for 5 times).

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Sorry PapaCharlie9 can i request another limits on this? i clearly know what i want now

 

 

when the server reach the time for restart (example 3am), and there are people playing in the server, the server will restart even if there are player in it BUT It will restart only when the round has ended. During that round, server will spam " Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server " (Yell & say) for the last 50 ticket left (TDM), every 10 ticket Drop (yell for 5 sec)(message will appear for 5 times).

Create a limit to evaluate OnIntervalServer, set interval to 15, set name to "Check for restart".

 

Set first_check to this Code:

 

Code:

int Hour24Clock = 3; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
String key = "Remember to restart server!";

// Are we waiting for the round to be over_
if (server.Data.issetBool(key)) {
    // If plugin.RoundData is reset, means round ended
    if (!plugin.RoundData.issetBool(key)) {
        server.Data.unsetBool(key);
        // If it's the appointed hour and the round has ended
        plugin.ConsoleWrite("^1AUTOMATIC RESTART OF POPULATED SERVER: " + server.PlayerCount);
        plugin.PRoConEvent("AUTOMATIC RESTART OF POPULATED SERVER: "  + server.PlayerCount, "Insane Limits");
        plugin.ServerCommand("admin.shutDown");
        return false;
    }
}

if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    if (server.PlayerCount < 4) {
        // If it's the appointed hour and a restart has not happened in the last 24 hours ...
        plugin.ConsoleWrite("^1AUTOMATIC RESTART OF EMPTY SERVER");
        plugin.PRoConEvent("AUTOMATIC RESTART OF EMPTY SERVER", "Insane Limits");
        plugin.ServerCommand("admin.shutDown");
    } else {
        // Else, there are players in the server, wait until round end
        if (!server.Data.issetBool(key)) {
            plugin.ConsoleWrite("There are " + server.PlayerCount + " players in the server, wait to restart after round end.");
            plugin.PRoConEvent("There are " + server.PlayerCount + " players in the server, wait to restart after round end.", "Insane Limits");
            server.Data.setBool(key, true);
            plugin.RoundData.setBool(key, true);
        }
    }
}
return false;
For the yell messages, do this:

 

Create a limit to evaluate OnKill, call it "End of round restart yells".

 

Set first_check to this Code:

 

Code:

String key = "Last Tickets";
String chk = "Remember to restart server!";

// Are we waiting for the round to be over_
if (!server.Data.issetBool(chk))
    return false;

double min = Math.Min(server.RemainTickets(1), server.RemainTickets(2));
if (!server.RoundData.issetDouble(key))
    server.RoundData.setDouble(key, 50);
double last = server.RoundData.getDouble(key);
if (min <= last) {
    server.RoundData.setDouble(key, last - 10);
    return true;
}
return false;
Set Action to your chat and yell actions. For example, set yell to:

 

Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 weeks later...

Originally Posted by TMiland*:

 

Hi, i am using this:

 

Code:

int Hour24Clock = 15;  // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
int DelaySeconds = 45; // CHANGE: Number of seconds after RoundOver to do the restart
String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
int YellDuration = 15; // CHANGE

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    Thread messenger = new Thread(new ThreadStart(delegate {
        try {
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
        } catch (Exception) {}
    }));
    messenger.Name = "RestartMessenger";
    messenger.Start();

    Thread timer = new Thread(new ThreadStart(delegate {
        try {
            Thread.Sleep(DelaySeconds * 1000);
            plugin.ConsoleWrite("^1AUTOMATIC RESTART OF ACTIVE SERVER");
            plugin.PRoConEvent("AUTOMATIC RESTART OF ACTIVE SERVER", "Insane Limits");
            plugin.ServerCommand("admin.shutDown");
        } catch (Exception) {}
    }));
    timer.Name = "AutoRestarter";
    timer.Start();
}

return false;
Are there any reason this isn't working? Servers have been up for 5 days w/o a restart now... :tongue:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Hi, i am using this:

 

Code:

int Hour24Clock = 15;  // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
int DelaySeconds = 45; // CHANGE: Number of seconds after RoundOver to do the restart
String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
int YellDuration = 15; // CHANGE

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    Thread messenger = new Thread(new ThreadStart(delegate {
        try {
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
        } catch (Exception) {}
    }));
    messenger.Name = "RestartMessenger";
    messenger.Start();

    Thread timer = new Thread(new ThreadStart(delegate {
        try {
            Thread.Sleep(DelaySeconds * 1000);
            plugin.ConsoleWrite("^1AUTOMATIC RESTART OF ACTIVE SERVER");
            plugin.PRoConEvent("AUTOMATIC RESTART OF ACTIVE SERVER", "Insane Limits");
            plugin.ServerCommand("admin.shutDown");
        } catch (Exception) {}
    }));
    timer.Name = "AutoRestarter";
    timer.Start();
}

return false;
Are there any reason this isn't working? Servers have been up for 5 days w/o a restart now... :tongue:
If you had that OnIntervalServer 15, it's a wonder Procon didn't crash every night!

 

You don't have anything that prevents more than one thread from starting. Every 15 seconds you would have launched a new pair of threads. The timer thread must be throwing an exception, that's the only thing that would prevent the shutdown. Or Procon crashing, I guess, that's the other thing.

 

If you really want to use threads (not advised), you should use LCARSx's long-lived thread code here: myrcon.net/.../insane-limits-timed-messaging-system-v20

 

Then you'd only have one thread, period.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by TMiland*:

 

If you had that OnIntervalServer 15, it's a wonder Procon didn't crash every night!

 

You don't have anything that prevents more than one thread from starting. Every 15 seconds you would have launched a new pair of threads. The timer thread must be throwing an exception, that's the only thing that would prevent the shutdown. Or Procon crashing, I guess, that's the other thing.

 

If you really want to use threads (not advised), you should use LCARSx's long-lived thread code here: myrcon.net/.../insane-limits-timed-messaging-system-v20

 

Then you'd only have one thread, period.

It's set to OnRoundOver...
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

It's set to OnRoundOver...

Oh, duh. Sorry, I didn't realize you are just using the limit from post #1.

 

Do you have the other limit as well? If you don't, the problem may be that your server dies (all players leave) before you get to the specified hour. Since there are no players, there is no round over event. If there is no round over event, there is no restart.

 

If you do have players ...

 

Check your event log. Do you see any of the AUTOMATIC RESTART OF ACTIVE SERVER messages at the expected hour? How about the chat messages in the chat log?

 

It's probably still an exception, that's the best explanation. Change the code to this:

 

Code:

int Hour24Clock = 15;  // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM
int DelaySeconds = 45; // CHANGE: Number of seconds after RoundOver to do the restart
String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
int YellDuration = 15; // CHANGE

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    Thread messenger = new Thread(new ThreadStart(delegate {
        try {
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
            Thread.Sleep(15 * 1000);
            plugin.PRoConChat("ADMIN > " + ChatMessage);
            plugin.SendGlobalMessage(ChatMessage);
            plugin.SendGlobalYell(YellMessage, YellDuration);
        } catch (Exception e) {
           plugin.ConsoleWrite("^8RestartMessenger: " + e);
        }
    }));
    messenger.Name = "RestartMessenger";
    messenger.Start();

    Thread timer = new Thread(new ThreadStart(delegate {
        try {
            Thread.Sleep(DelaySeconds * 1000);
            plugin.ConsoleWrite("^1AUTOMATIC RESTART OF ACTIVE SERVER");
            plugin.PRoConEvent("AUTOMATIC RESTART OF ACTIVE SERVER", "Insane Limits");
            plugin.ServerCommand("admin.shutDown");
        } catch (Exception e) {
           plugin.ConsoleWrite("^8AutoRestarter: " + e);
        }
    }));
    timer.Name = "AutoRestarter";
    timer.Start();
}

return false;
That will print a message in the plugin log if there is an exception.

 

BTW, if you have a layer, you need to run this on the layer, or at least make sure your account has restart privilege.

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 weeks later...

Originally Posted by TMiland*:

 

You should use both.

Okay, i don't think i want to restart the server if it is populated, so i just need the first limit.

Besides when my seeding accounts still sits in the server overnight... 1-3 accounts.

 

And i want to set a map before it restarts, would this work?

 

Code:

int Hour24Clock = 5; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM

if (server.PlayerCount != 3)
    return false;

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    plugin.ConsoleWrite("^1AUTOMATIC RESTART OF EMPTY SERVER");
    plugin.PRoConEvent("AUTOMATIC RESTART OF EMPTY SERVER", "Insane Limits");
    plugin.ServerCommand("mapList.setNextMapIndex", "MP_Naval");
    plugin.ServerCommand("admin.shutDown");
}
return false;
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

Okay, i don't think i want to restart the server if it is populated, so i just need the first limit.

Besides when my seeding accounts still sits in the server overnight... 1-3 accounts.

 

And i want to set a map before it restarts, would this work?

 

Code:

int Hour24Clock = 5; // CHANGE: 0 to 23 o'clock, 3 is 3AM, 15 is 3PM

if (server.PlayerCount != 3)
    return false;

// If it's the appointed hour and a restart has not happened in the last 24 hours ...
if (DateTime.Now.Hour == Hour24Clock && (server.TimeUp/(60*60)) > 24) {
    plugin.ConsoleWrite("^1AUTOMATIC RESTART OF EMPTY SERVER");
    plugin.PRoConEvent("AUTOMATIC RESTART OF EMPTY SERVER", "Insane Limits");
    plugin.ServerCommand("mapList.setNextMapIndex", "MP_Naval");
    plugin.ServerCommand("admin.shutDown");
}
return false;
No, that won't work. Your server starts with whatever map is first in your maplist.txt file.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by TMiland*:

 

No, that won't work. Your server starts with whatever map is first in your maplist.txt file.

No, that's the problem, it starts on the map it was on last, i am using Ultimate maplist manager.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

No, that's the problem, it starts on the map it was on last, i am using Ultimate maplist manager.

Ah, I see. Well, maybe that will work then? UMM probably needs for the next round to actually start, so that it can remember that was the last map. You should post on the UMM thread and explain what you are doing and ask what the minimum set of commands you'd need for UMM to remember your "last map". I suspect that setting the next index isn't sufficient, but it might be.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by TMiland*:

 

Ah, I see. Well, maybe that will work then? UMM probably needs for the next round to actually start, so that it can remember that was the last map. You should post on the UMM thread and explain what you are doing and ask what the minimum set of commands you'd need for UMM to remember your "last map". I suspect that setting the next index isn't sufficient, but it might be.

There was a setting to start with first map, i had it set to start with first map unless it was just played. :woot:

 

Problem solved! :smile:

* Restored post. It could be that the author is no longer active.
Link to comment
  • 4 weeks later...

Originally Posted by _gp_*:

 

Lately, I find there are days my bf3 server needs to be restarted more than once a day...

 

Usually there is an admin in server during these times, and can see how players are reacting and need to restart server...

 

so I swiped your code and reworked it so a server admin can restart server anytime using chat..

it is not pretty but it works...

 

!StopServer or /!StopServer

 

limit name: RestartServer

 

evaluation: OnAnyChat

 

first check: Expression

 

expression: (true)

 

2nd check: Code

 

code

 

Code:

//swiped from PC9 and butchered by groundpounder55
String ChatMessage = "Server RESTARTING NOW to BOOST Gameplay Performance! Please REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE
String YellMessage = "Server RESTARTING NOW to BOOST Gameplay Performance!\nPlease REJOIN IN 2 MINUTES to Play on a Fresh Server"; // CHANGE

int YellDuration = 10; // CHANGE

// check if admin
// --------- Booleans --------- //
bool     isAdmin = false;
bool     bKill   = false;
bool     bKick   = false;
bool     bBan    = false;
bool     bMove   = false;
bool     bLevel  = false;

// ***** END OF VARIABLES ***** //



// *********** CODE ********** //

// Set Admin flag appropriately
if (plugin.CheckAccount(player.Name, out bKill, out bKick, out bBan, out bMove, out bLevel))
{
    // Admin must be able to Kill, Kick and Ban
    if (bKill && bKick && bBan) isAdmin = true;
}

if (isAdmin)
    {
	if (player.LastChat.StartsWith("!StopServer")||player.LastChat.StartsWith("/!StopServer"))
		{
			Thread timer = new Thread(new ThreadStart(delegate
			{
			try {
					plugin.PRoConChat("ADMIN > " + ChatMessage);
					plugin.SendGlobalMessage(ChatMessage);
					plugin.SendGlobalYell(YellMessage, YellDuration);
					Thread.Sleep(10* 1000);
					plugin.PRoConChat("ADMIN > " + ChatMessage);
					plugin.SendGlobalMessage(ChatMessage);
					plugin.SendGlobalYell(YellMessage, YellDuration);
				    
					Thread.Sleep(10 * 1000);
					plugin.PRoConChat("ADMIN > " + ChatMessage);
					plugin.SendGlobalMessage(ChatMessage);
					plugin.SendGlobalYell(YellMessage, YellDuration);
            	    
					Thread.Sleep(30 * 1000);
					plugin.ConsoleWrite("^1AUTOMATIC RESTART OF ACTIVE SERVER");
					plugin.PRoConEvent("AUTOMATIC RESTART OF ACTIVE SERVER", "Insane Limits");
					plugin.ServerCommand("admin.shutDown");
				} catch (Exception) {}
			}));
			timer.Name = "AutoRestarter";
			timer.Start();
		
		}
	}
    
return false;
action: none

 

thx for what you do PapaCharlie

 

_gp?

* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 months later...

Originally Posted by PapaCharlie9*:

 

If i had this in my pbsvuser.cfg, this plugin wouldn't work right?

 

Code:

pb_sv_uconignore admin.shutdown
Uh ... that shouldn't make any difference, I think. That command should only block an outside (third party) connection to pbsv itself, like a streaming service (GGC-Stream), from sending that command.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by PapaCharlie9*:

 

@PapaCharlie9:

I had that command in my pbsvuser.cfg and it broke the plugin

But that doesn't make any sense. For that to be true, it would mean that all RCON commands go to pbsv first, then are directed to the game server.

 

Are you sure it wasn't a coincidence? Try:

 

pb_sv_uconignore maplist.setNextMapIndex

 

and see if it prevents Procon from setting the next map in the Lists/Maplist tab, skip down a few maps, right click and Set as next map. Does it work or not?

* Restored post. It could be that the author is no longer active.
Link to comment

Archived

This topic is now archived and is closed to further replies.



  • Our picks

    • Game Server Hosting:

      We're happy to announce that EZRCON will branch out into the game server provider scene. This is a big step for us so please having patience if something doesn't go right in this area. Now, what makes us different compared to other providers? Well, we're going with the idea of having a scaleable server hosting and providing more control in how you set up your server. For example, in Minecraft, you have the ability to control how many CPU cores you wish your server to have access to, how much RAM you want to use, how much disk space you want to use. This type of control can't be offered in a single service package so you're able to configure a custom package the way you want it.

      You can see all the available games here. Currently, we have the following games available.

      Valheim (From $1.50 USD)


      Rust (From $3.20 USD)


      Minecraft (Basic) (From $4.00 USD)


      Call of Duty 4X (From $7.00 USD)


      OpenTTD (From $4.00 USD)


      Squad (From $9.00 USD)


      Insurgency: Sandstorm (From $6.40 USD)


      Changes to US-East:

      Starting in January 2022, we will be moving to a different provider that has better support, better infrastructure, and better connectivity. We've noticed that the connection/routes to this location are not ideal and it's been hard getting support to correct this. Our contract for our two servers ends in March/April respectively. If you currently have servers in this location you will be migrated over to the new provider. We'll have more details when the time comes closer to January. The new location for this change will be based out of Atlanta, GA. If you have any questions/concerns please open a ticket and we'll do our best to answer them.
      • 5 replies
    • Hello All,

      I wanted to give an update to how EZRCON is doing. As of today we have 56 active customers using the services offered. I'm glad its doing so well and it hasn't been 1 year yet. To those that have services with EZRCON, I hope the service is doing well and if not please let us know so that we can improve it where possible. We've done quite a few changes behind the scenes to improve the performance hopefully. 

      We'll be launching a new location for hosting procon layers in either Los Angeles, USA or Chicago, IL. Still being decided on where the placement should be but these two locations are not set in stone yet. We would like to get feedback on where we should have a new location for hosting the Procon Layers, which you can do by replying to this topic. A poll will be created where people can vote on which location they would like to see.

      We're also looking for some suggestions on what else you would like to see for hosting provider options. So please let us know your thoughts on this matter.
      • 4 replies
    • Added ability to disable the new API check for player country info


      Updated GeoIP database file


      Removed usage sending stats


      Added EZRCON ad banner



      If you are upgrading then you may need to add these two lines to your existing installation in the file procon.cfg. To enable these options just change False to True.

      procon.private.options.UseGeoIpFileOnly False
      procon.private.options.BlockRssFeedNews False



       
      • 2 replies
    • I wanted I let you know that I am starting to build out the foundation for the hosting services that I talked about here. The pricing model I was originally going for wasn't going to be suitable for how I want to build it. So instead I decided to offer each service as it's own product instead of a package deal. In the future, hopefully, I will be able to do this and offer discounts to those that choose it.

      Here is how the pricing is laid out for each service as well as information about each. This is as of 7/12/2020.

      Single MySQL database (up to 30 GB) is $10 USD per month.



      If you go over the 30 GB usage for the database then each additional gigabyte is charged at $0.10 USD each billing cycle. If you're under 30GB you don't need to worry about this.


      Databases are replicated across 3 zones (regions) for redundancy. One (1) on the east coast of the USA, One (1) in Frankfurt, and One (1) in Singapore. Depending on the demand, this would grow to more regions.


      Databases will also be backed up daily and retained for 7 days.




      Procon Layer will be $2 USD per month.


      Each layer will only allow one (1) game server connection. The reason behind this is for performance.


      Each layer will also come with all available plugins installed by default. This is to help facilitate faster deployments and get you up and running quickly.


      Each layer will automatically restart if Procon crashes. 


      Each layer will also automatically restart daily at midnight to make sure it stays in tip-top shape.


      Custom plugins can be installed by submitting a support ticket.




      Battlefield Admin Control Panel (BFACP) will be $5 USD per month


      As I am still working on building version 3 of the software, I will be installing the last version I did. Once I complete version 3 it will automatically be upgraded for you.





      All these services will be managed by me so you don't have to worry about the technical side of things to get up and going.

      If you would like to see how much it would cost for the services, I made a calculator that you can use. It can be found here https://ezrcon.com/calculator.html

       
      • 11 replies
    • I have pushed out a new minor release which updates the geodata pull (flags in the playerlisting). This should be way more accurate now. As always, please let me know if any problems show up.

       
      • 9 replies
×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.