[Mod] Simple Shutdown helper [v1.5] [timer_shutdown]

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

[Mod] Simple Shutdown helper [v1.5] [timer_shutdown]

by fairiestoy » Thu Aug 01, 2013 18:17

Hello there,

since it could be some kind of annoying if the server just suddenly shuts down by operator request, i made this little tool. This way, server admins and/or moderators can shut down the server with a reason which is printed to all users. And it also only shuts down after a given time.

License: - No license -
Version: 1.5
Features:
> Countdown
It counts the seconds from 5 down to 0
( up to now, its also counting the *.5 values too, will be fixed soon )
> User privs
To use this command, one has to have the privilege 'q_shutdown'
This might be useful if you grant this to a trustful moderator and
have a automatic restart script running for minetest (may be added into
this mod also, but its only a idea for now), the moderator will be capable
of restarting the server with this request.
> (Basic) Logging
This mod logs the reason and the name when this command has been called.
Should a user abuse this feature, the server admin could easily revoke the priv
> Global Reason message
Up to now, it only supports one word as reason (example "Restart"). It will support
a string later (planned for v1.6). It sends a global chat message to all players with the
time when it will shut down, and the reason
> Time based shutdown
The <time> parameter takes the seconds when the server should shut down
> Remote Control shutdown
(Up to now insecure, please wait for future release) It currently works with a local file.
If a user called the /remote_control on command, it will check a file every 200 server
steps ( i took this value to maybe reduce performance impact due to io operations )
-- since v1.5
> Performance shutdown
Implemented a function, which checks if the server globalstep delay is to huge. If the
expected steps according to the server settings are about 75% higher than the steps that
Should have kicked in, the server will shut down.
Warning!This is only usable if you have a automatic restart script for your server.
> Empty user list shutdown
Shuts the server down, if the user list is empty

I checked the forum search, but i found nothing similiar. If there is already something like this, just let me know :3

Ver 1.5
Download (Github)
Source:
fairiestoy/timer_shutdown @Github

Greetings
Last edited by fairiestoy on Sat Aug 03, 2013 17:13, edited 1 time in total.
Interesting about new things is, to figure out how it works ...
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Thu Aug 01, 2013 18:25

Good idea, even though most server admins seem to do that manually already.
A list of my mods can be found here.
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Thu Aug 01, 2013 19:16

A feature I'd love to see is one where you can set a one-time, future shutdown to happen when the last user signs off, which would work best when the server is run with some kind of auto-restart script (I think most of us do that).

That way, when you see some significant update to the Minetest engine or to one or more of your mods, you can download and update them, and then schedule the server to shut down exactly once (and presumably auto-restart) as soon as there's no one left online.

This would allow the admin to set up some updates and just walk away to run errands or whatever, without having to babysit the server waiting for an opportunity to restart manually, or interrupting someone's play.
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

by BrandonReese » Thu Aug 01, 2013 19:52

VanessaE wrote:A feature I'd love to see is one where you can set a one-time, future shutdown to happen when the last user signs off, which would work best when the server is run with some kind of auto-restart script (I think most of us do that).

That way, when you see some significant update to the Minetest engine or to one or more of your mods, you can download and update them, and then schedule the server to shut down exactly once (and presumably auto-restart) as soon as there's no one left online.

This would allow the admin to set up some updates and just walk away to run errands or whatever, without having to babysit the server waiting for an opportunity to restart manually, or interrupting someone's play.


I've had this idea in my head for a few weeks and haven't had time to work on it. I bet fairiestoy could update his mod to make it do this.
 

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

by fairiestoy » Thu Aug 01, 2013 20:23

VanessaE wrote:A feature I'd love to see is one where you can set a one-time, future shutdown to happen when the last user signs off, which would work best when the server is run with some kind of auto-restart script (I think most of us do that).


Already added. If someone could test it, i would appreciate it. I made a local test with two clients connecting. The admin client called the command and left. After the guest client disconnected, the server shutted down.

Edit:

Usage:
Call ingame /shutdown_if_empty <qots_id> where the id is any string (unused now, but may be relevant if one decides to make this avaible to mods for tracking abuse).
Up to now, this works only for the ingame call. The RC method will be implemented later since i have to think about a relative function for calling RC methods (now its fixed for one specific purpose).
Last edited by fairiestoy on Thu Aug 01, 2013 20:28, edited 1 time in total.
Interesting about new things is, to figure out how it works ...
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Fri Aug 02, 2013 09:35

Also, as an aside, "no license" is not valid. If you don't have a specific license in mind or didn't think you needed one, you probably meant to release to Public Domain. In that case, use WTFPL or CC0 as your license. Maybe BSD might be suitable also, if you want to retain at least some semblance of authorship.

http://en.wikipedia.org/wiki/WTFPL
http://creativecommons.org/choose/zero/
http://en.wikipedia.org/wiki/BSD_licenses
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Fri Aug 02, 2013 12:38

Very useful for servers. Also, "-no license- is not applicable. I think WTFPL would suit your needs if you don't want it to have a license.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Fri Aug 02, 2013 14:42

VanessaE wrote:Also, as an aside, "no license" is not valid.


Not to get technical, but no license is basic copyright. I think you might have meant he should choose some license if he wants to get this past /general.

fairiestoy, could you could do a feature that auto-restarts on crash?
Last edited by mauvebic on Fri Aug 02, 2013 14:48, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

by fairiestoy » Fri Aug 02, 2013 16:46

mauvebic wrote:I think you might have meant he should choose some license if he wants to get this past /general.

fairiestoy, could you could do a feature that auto-restarts on crash?

Point 1)
So a given license is only important to get this topic moved to Mod Releases? However, i will use the WTFPL since i like the phrase 'Do what the fuck you want to ...' taking effect on source code.
Point 2)
Have you something special in mind? Since there are some scripts out there that may be much more tested instead of re-inventing the weel. If you run Linux, this could be one example:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
while true;do;minetestserver <commandline parameters>;sleep 1;done

The landrush server for example uses a similiar bash script afaik. If you are looking for something with some advanced features, I would like to give it a try.
Last edited by fairiestoy on Fri Aug 02, 2013 16:48, edited 1 time in total.
Interesting about new things is, to figure out how it works ...
 

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

by fairiestoy » Sat Aug 03, 2013 17:15

Testers wanted!
Since version 1.5, i made a routine that will check the server performance according to the globalsteps and will shut everything down if the expected globalsteps are about 75% higher than the realized globalsteps. But up to now, i was not capable of creating a situation to test this. If someone knows a way, or is capable of creating a situation with a laggy server: Could you please give feedback if everything works like it should?

In game command: /activate_performance_shutdown
Last edited by fairiestoy on Sat Aug 03, 2013 17:16, edited 1 time in total.
Interesting about new things is, to figure out how it works ...
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

by BrandonReese » Sat Aug 03, 2013 17:40

Just installed it to test your active performance shutdown. It would be nice if you sent a chat message after each command just so the user knows the command was received and executed.
 

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

by fairiestoy » Sat Aug 03, 2013 22:38

BrandonReese wrote:Just installed it to test your active performance shutdown. It would be nice if you sent a chat message after each command just so the user knows the command was received and executed.

Thanks for the test and the clue with the output on activation. I already updated it, and added a little thing to give the server 5 chances before shutting it down because of bad performance. I did this, because performance could get sometimes a bit low even on a local running server when joining. Maybe this keeps the server from being shut down after restart.
Interesting about new things is, to figure out how it works ...
 

User avatar
fairiestoy
Member
 
Posts: 191
Joined: Sun Jun 09, 2013 19:25

by fairiestoy » Sun Aug 04, 2013 18:24

* Updatet
I make the performance shutdown more persistent. Once you activated it, it will be active for 3 more restarts.
As long as the minetest.conf is not changing
Interesting about new things is, to figure out how it works ...
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 15 guests

cron