[#12] Adding scheduled shutdown
[#12] Adding scheduled shutdown
This commit adds support for a new global directive "ShutdownTime", like ContestTimes or ConfigExpirationTime, that schedules a shutdown at the time defined.
Hey @DT3264, I was notified for review on this, but I don't see any upcoming change after my last review. Was this request right?
@equetzal There's no need to re-review this one yet, dunno why that review was requested
@equetzal I now asked for review intentionally, I amended the requested changes
I think I'll rework this PR later on after the OMI thing has happened, in the meantime I'll leave a thought I had about this feature
Maybe the shutdown thing could be simpler, just a service asking each minute "Is the current datetime equal or greater than the shutdown datetime provided?" And to avoid conflicts with the mode change, maybe if there's a mode change nearby skip the shutdown until the mode change had taken place,
wdyt?
I think I'll rework this PR later on after the OMI thing has happened, in the meantime I'll leave a thought I had about this feature
Maybe the shutdown thing could be simpler, just a service asking each minute "Is the current datetime equal or greater than the shutdown datetime provided?" And to avoid conflicts with the mode change, maybe if there's a mode change nearby skip the shutdown until the mode change had taken place,
wdyt?
I like the approach of instead of scheduling the shutdown with shutdown, do it like "schedule a script execution" which when executed actually powers off the machine. This way we can implement this in numerous ways, we could use at, cron, systemd-run, etc. And the shutdown op would always be like 'shutdown now'. Inside, the op could be a systemd-service that conflicts with both hsync.service and happly.service so that the execution waits until the directives are applied to then shutdown the system.
About the thing with mode change, is not -that- important, the problem is the accuracy of the time, because if I do some op at min 0 and shutdown at min 1 I don't expect the system to shutdown before, but this can be solved by the systemd service I told you.