03-03-2023, 11:44 AM
(03-03-2023, 10:39 AM)franktw956 Wrote:(03-03-2023, 08:03 AM)bitlab Wrote: @franktw956 concerning the safe-shutdown you can arrange it almost with only use of overlays.
You can find more back about it on:
- https://www.bitlab.nl/page_id=291 (main overview build)
- https://www.bitlab.nl/page_id=382 (soft power off only)
- https://www.bitlab.nl/page_id=459 (update to the intial build; using solid state relay + pcb)
- https://github.com/bitkeeper/dddac1794bu...i/software -> Soft Power Down section config files for service and overlay.
Thank you, bitlab, it helps for the shutdown event.
I am using the power-off cmd in GPIO button settings, and it is running good.
I just have no idea for the system-ready event, may be a log file/registers/flags...to indicate moode has booted completely already?
The boot sequence has two parts: Linux startup and moOde startup.
When Linux startup is complete it runs the system script /etc/rc.local. At the end of this script the PHP script (/var/www/daemon/worker.php) that performs moOde startup and subsequent job processing is run.
At the beginning of worker.php the SQL param 'wrkready' is set to '0'. When the startup section of worker.php completes the param is set to '1'. This signifies "moOde startup complete" which means that all daemons including MPD have been started, the WebUI can connect and all functions are available.
Run the command below to get the value.
Code:
# Using moodeutl
moodeutl -q "select value from cfg_system where param='wrkready'"
# Using sqlite3
sqlite3 /var/local/www/db/moode-sqlite3.db "select value from cfg_system where param='wrkready'"
Also, when Menu, Shutdown, Restart or Power off is clicked the param 'wrkready' is set to '0'. This is to signal another script in moOde that it should ignore requests from the WebUI.