AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Restart Empty Server (or Map) (https://forums.alliedmods.net/showthread.php?t=315367)

Dragokas 04-04-2019 12:40

[ANY] Restart Empty Server (or Map)
 
1 Attachment(s)
Description:
Restarts the server (or changes the map) when all players leave the game / or optionally, by the scheduled hours.
Features:
- 3 methods of server restart: using "crash", using "_restart", or just change the map.
- Grace period - plugin waits some time for a new player to connect before actually decide to restart.
- unloads the "Accelerator" extension to prevent false crash reports.
- correctly free resources by unloading all plugins before actual restarting
- Able to remove the false crash log in the "CRASH" folder - some servers create it
- Control sv_hibernate_when_empty ConVar. Some admins (hosters) setup it, so many similar plugins cannot perform a restart due to plugin freeze.
- (optionally) start-end hours where restart allowed
- (optionally) start-end hours to force restart (with kicking the players)
- (optionally) restrict the frequency of restarting
- the restart time is logged to file: addons/sourcemod/logs/restart.log
Recommended for:
- prophylaxis
- fixing the bug related to resetting all ConVars to defaults (seen on some servers). The source of the problem is unknown.
Requirements:
- Regexp extension (included in SourceMod).
Settings (ConVars):
see: cfg/sourcemod/sm_restart_empty.cfg:

- sm_restart_empty_enable - def.: 1 - Enable plugin (1 - On / 0 - Off)
- sm_restart_empty_method - def.: 2 - When server is empty, what to do? 1 - _restart, 2 - crash (use if method # 1 is not work), 3 - just change map
- sm_restart_empty_delay - def.: 1.0 - Grace period (in sec.) waiting for new player to join until actually decide to restart the server
- sm_restart_empty_unload_ext_num - def.: 0 - If you have Accelerator extension, you need specify here order number of this extension in the list: sm exts list
- sm_restart_empty_min_period - def.: 0 - Minimum period (in hours) this plugin should wait before the next restarting is allowed (0 - disable, 24 - allow once per day)
- sm_restart_empty_limit_hour_start - def.: 0 - Allow rebooting to be started from this hour only (paired with "*_end" ConVar)
- sm_restart_empty_limit_hour_end - def.: 24 - Allow rebooting until this hour only (paired with "*_start" ConVar)
- sm_restart_empty_force_hour_start - def.: -1 - Start hour for force rebooting (if last reboot happened > 24 hours ago) and somebody leaves during this hour (paired with "*_end" ConVar) (-1 to disable)
- sm_restart_empty_force_hour_end - def.: -1 - End hour for force rebooting (if last reboot happened > 24 hours ago) and somebody leaves during this hour (paired with "*_start" ConVar) (-1 to disable)
- sm_restart_empty_utc_delta - def.: 0.0 - If your server has incorrect time, you can set UTC correction hours here (they will be appended to a server time)
- sm_restart_empty_server_start_changemap - def.: 0 - When server restarted, change map to the random one from the file: data/restart_empty_maps.txt (1 - Yes / 0 - No)
Commands: (both intended for plugin setup stage)
sm_restarter_ctime - Check the server time taking into account UTC delta ConVar
sm_restarter_accelerator - Show auto-detected order number of Accelerator extension
Installation
1. Unpack the archive and place its contents to addons/sourcemod
2. If you plan to use map change features, edit file "addons/sourcemod/data/restart_empty_maps.txt" inserting your own map list (one per line) you want to randomly change map to.
3. Change the map.
4. See Suggestions on Setup section
5.
If you have "Accelerator" extension, do this:

Suggestions on Setup
Spoiler


Credits:
- @Luckylock - for alternative way of reboot, "crash" command.
- @Forgetest - for coding auto-detection of Accelerator extension order number.
Related plugins:
[ANY] Vote server restart
ChangeLog
Spoiler


Donate
Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money

Ejziponken 04-04-2019 12:55

Re: [ANY] Restart empty server
 
Does this keep restarting all night if there are no players? :P

Dragokas 04-04-2019 12:59

Re: [ANY] Restart empty server
 
No, only once :) It track "player_disconnect" event.

PwnK 04-04-2019 13:18

Re: [ANY] Restart empty server
 
Looks good :up:

I need to test this on my server because some people always complain about auto restart in the night.

Zuby24 04-04-2019 14:02

Re: [ANY] Restart empty server
 
Nice plugin!
Wait to see if it works (see on tonight :D)

Ejziponken 04-04-2019 14:05

Re: [ANY] Restart empty server
 
We are using a plugin to restart the server every night. Now this plugin wont just restart the server at set time, it will wait until the server is empty, like this plugin..

The problem is that sometimes a server never actually gets empty, and then the server wont restart and it will start to perform worse over time.

It would be nice if the plugin could keep track if it did restart after the set time, and if not, it could force an restart at a second specified time with some warning in the chat before it goes down. like when its 5 min left and when its 30 seconds left or something.

For example:
DM #3 is set to restart at 5am. But since its a popular server, the players stay on it all night and and it wont actually have a chance to restart again until 5am next morning. So with this new idea, the server would force a restart at maybe 2pm and then again at 5am if the server is empty. :p

AK978 04-04-2019 14:15

Re: [ANY] Restart empty server
 
Does server sleep not affect the timer?

Dragokas 04-04-2019 14:57

Re: [ANY] Restart empty server
 
Ejziponken, ok, I will add such feature later.

Quote:

Originally Posted by AK978 (Post 2646309)
Does server sleep not affect the timer?

It should be compatible.
Quote:

Originally Posted by Dragokas
- Control sv_hibernate_when_empty ConVar. Some admins (hosters) setup it, so many similar plugins cannot perform a restart.


DabberDoug 04-06-2019 16:29

Re: [ANY] Restart empty server
 
Is there a way to make this restart the server when the match ends

Dragokas 04-06-2019 16:53

Re: [ANY] Restart empty server
 
Is it really necessary and why? What game is it for? I'm unsure about how to catch that event.


All times are GMT -4. The time now is 06:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.