Moode Forum

Full Version: enable gpio output when boot is complete
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi folks;  Does anyone have an idea on how I might enable a GPI pin when boot up is complete.  I can setup a service to enable the pin but I am not sure how to have the action taken only after the boot up process has finished.

Thanks
hi, I also need this function since my external power control circuit detects gpio HIGH when boot succes and goes LOW for shuting down.
Run the commands below. If they all return "1" then high likelihood that moOde has successfully completed its boot sequence and all is well.

Code:
pi@rp1:~ $ moodeutl -q "select value from cfg_system where param='wrkready'"
1
pi@rp1:~ $ pgrep -c watchdog.sh
1
pi@rp1:~ $ pgrep -c mpd
1
Hi Wallyboy

I use the following in a (longer) shell script to pause until the Moode boot has completed (it doesn't check that MPD has started)


Code:
  ...
  # wait for worker to start to ensure start flag is set to 0
   until ps -C worker.php > /dev/null; do
      sleep 2
   done
   sleep 1     # extra time allow to set flag
   until test $(moodeutl -q "select value from cfg_system where param='wrkready'") = "1"; do
      sleep 4
   done
...

If you are using a systemd service file then you can wait for a script to complete using an ExecStartPre line 

Adrian.