Author
|
Message
|
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
|
04-04-2019
, 12:40
[ANY] Restart Empty Server (or Map)
|
#1
|
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
Installation1. 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:
Execute command:
Code:
sm_restarter_accelerator
It must show extension number (or not).
Compare this number with the number from the next step.
Run in server console such command:
You'll see something like this:
Code:
sm exts list
[SM] Displaying 14 extensions:
[01] [L4D2] 8+ Players BugFixes (1.0.6): This extension try fix some bugs on server have more than 8 players
[02] Accelerator (2.5.0): SRCDS Crash Handler
As you see, Accelerator is under number "02".
Compare this number with the one displayed when you entered command sm_restarter_accelerator.
- If it is match, you don't need to do anything. Stop here.
- If not match:
you need to set ConVar "sm_restart_empty_unload_ext_num" to "2" in cfg/sourcemod/sm_restart_empty.cfg file (replace "2" to your own order number).
Suggestions on Setup
Spoiler
- If you want your server will restart not often than 12 hours (when all players leave the game), set sm_restart_empty_min_period to "12"
- If you want to restrict the hours of the day where restart is allowed, set the pair of ConVars:
Code:
sm_restart_empty_limit_hour_start 0
sm_restart_empty_limit_hour_end 24
by default, it's 0-24. You can set like 3-5:
Code:
sm_restart_empty_limit_hour_start 3
sm_restart_empty_limit_hour_end 5
or even 23-2 (means, near midnight):
Code:
sm_restart_empty_limit_hour_start 23
sm_restart_empty_limit_hour_end 2
- The same calculation is appropriate for the forcing restart the server. Use:
Code:
sm_restart_empty_force_hour_start "4"
sm_restart_empty_force_hour_end "5"
That is mean, if the last server restart has happened >= 24 hours ago,
and if the current server time is somewhere between 4-5 o'clock,
the server will restart even if there are still human players.
They will receive a kick with message "Server Restarts".
Note: the restart is only happening if somebody will leave the game during these hours,
because the plugin catches exactly that event and doesn't use timers.
- Ensure: your server has a correct time by executing "sm_restarter_ctime" command.
If no, you have 2 options:
* fix the time in the server, e.g. for Linux, you can check timezone using command "timedatectl"
and change timezone using command "timedatectl set-timezone TIME-ZONE"
* use ConVar "sm_restart_empty_utc_delta" to append some hours to the actual server time,
then execute "sm_restarter_ctime" again to verify it.
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
DonateDonates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money
__________________
Last edited by Dragokas; 01-07-2023 at 10:28.
|
|
|
|