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