Auto Power-on?
# │forum
u
They're alive!!! But now the questions about recovering from power outages come. Two of these nodes are also going to host Pi-hole servers. They're on an UPS but I'd prefer not to have to field questions on how to get the internet back after a power outage that last more than an hour if I happen to be put of town. Is there a way to have the BMC remember the state and have them power back up when power is restored?Does this require the RTC battery or something?
d
Not for now. I don't know about the new firmware that the Team is developing, but the Community Edition of the firmware is going to gain this ability in some near future
In meantime, I guess you can write a script that starts given nodes
u
Does BMC have Cron or will I need to do it on another machine that does come back after an outage?
d
If you go to
/etc/init.d/S99hello.sh
, you could add
tpi
commands there I guess, although maybe with some delay to let the
bmc
process start
u
That might work. The script to start them would be pretty small.
d
I mean you edit the script I mentioned and add the commands there
t
This is my basic init.d script that turns on Node 4 only, as well as syncing the clock. #! /bin/sh echoLog(){ tee -a /tmp/startupLog.txt} diagnosticsPrint(){echo "[Attempt $webAttempts, $(date +%H:%M:%S)] "} startupRoutine(){ echo "########## Executing custom items ##########" | echoLog echo "==> Setting date from hw clock:" | echoLog hwclock -s && date | echoLog echo "==> Attempting to start Node 4" | echoLog webAttempts=1 until $(curl --output /dev/null --silent --head --fail http://localhost); do webAttempts=$(( $webAttempts + 1 )) echo "$(diagnosticsPrint) Waiting for webserver start. " | echoLog sleep 1 done echo "$(diagnosticsPrint) Webserver online - starting nodes" | echoLog curl -s "http://localhost/api/bmc?opt=set&type=power&node4=1" | echoLog } case "$1" in start) startupRoutine ;; stop) ;; restart) startupRoutine ;; status) # code to check status of app comes here # example: status program_name ;; *) echo "Usage: $0 {start|stop|status|restart}" esac echo "" exit 0
2 Views