Skip to content

Part 4. Monitor a Reboot

jrbail01 edited this page Dec 12, 2016 · 2 revisions

If power drops, our process will instantly die as will our monitoring script and network connection. On reboot, we need to do two things.

  1. Send an update to our process dashboard that our process exited.
  2. Automatically start our process and process monitor after the reboot completes.

First, let's create a script that will run on reboot to send a process exited status to our dashboard. We will use the script at https://github.com/initialstate/pi-process-dashboard/blob/master/monitor_reboot.py.

The user settings need to be set:

# --------- User Settings ---------
# Initial State settings
BUCKET_NAME = ":computer: Processes" 
BUCKET_KEY = "pr1208"
ACCESS_KEY = "PLACE YOUR INITIAL STATE ACCESS KEY HERE"
PROCESS_NAME = "PLACE THE NAME OF YOUR PROCESS HERE"
# Set the time to wait until you are sure reboot is complete and network connections are restored (i.e. power outage)
MINUTES_DELAY = 5
# ---------------------------------

Make sure you use the same BUCKET_KEY, ACCESS_KEY, and PROCESS_NAME as in step 2. Once this script is setup, we need to call it automatically on reboot.

<< Part 3: Launch a Monitored Process - Part 5: Automatically Launch on Boot >>