huronOS-build-tools icon indicating copy to clipboard operation
huronOS-build-tools copied to clipboard

[#12] Adding scheduled shutdown

Open DT3264 opened this issue 2 years ago • 5 comments

[#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.

DT3264 avatar Jun 02 '23 20:06 DT3264

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 avatar Aug 10 '23 18:08 equetzal

@equetzal There's no need to re-review this one yet, dunno why that review was requested

DT3264 avatar Aug 10 '23 18:08 DT3264

@equetzal I now asked for review intentionally, I amended the requested changes

DT3264 avatar Aug 10 '23 23:08 DT3264

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?

DT3264 avatar Aug 12 '23 05:08 DT3264

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.

equetzal avatar Aug 12 '23 15:08 equetzal