Howdy,
It’s been a few years since I’ve been around dietpi but I’m working on rebuilding my little MinIO server. With that I’m always looking at new features I want on my own stuff. My main use is as a backup server and while I could just leave the device all the time I prefer not to – partially for eletrical waste (rather than $ waste), part to lessen wear on drives, and a lot b/c I like the challenge.
As a MinIO backup server I really only need it on while backups are running. Ideally, it would wake on lan and shut down when backups are done. Startup for me is likely going to be RTC related but for x86 or boards that support WOL that would be rad. That brings up to what I am working on and was wondering if a) I am reinventing the wheel and b) if there was any interst in my contrinuting code to roll it into DietPi proper.
It is actually rather simple:
It is a script that checks MQTT retained messages and if certain states are true it waits confirms that state and then sends the board into standby state or shuts it off. I know different boards have different abilities so that may be a challenge here.
For example - I’m running backups. So each backup has its own MQTT status:
backups\1
backups\2
backups\3
backups\4
backups\5
Using the retain flag each one of those containts either “Started” or “Stopped”
The script just readys backups# and if it finds the word “Started” does nothing. And if it finds “Stopped” it waits the same amount of time as the cron job (right now 15 minutes) and checks again. If the second check also doesn’t find a 'Started" flag it shutsdown/sleep.
Then the RTC / WOL would wake the board at the right time.
Bonus Logic: For my use I’m also looking at integrating a clear of the states so the server would wait for at least one state to be present before considering shutting down. This would make sure the backup server is one for the next backup run in case something got out of sync between them b/c I can’t use WOL.
That is my case but for DietPi we could just check all “dietpi/#” status. Have an option to set the interval and maybe the command (provide a default?) in a gui menu in dietpi. Change the flags to something more generic like “Sleep” and “KeepAlive”. So folks could write any status they want to the “dietpi” node and once it sees all “Sleep” nodes it would do the command.
It is simple, straightforwrd, and lightweight so it seemed very much like DietPi.
If there is already a feature in DietPi please let me know too
-techdabbler