Email CPU usage

Say you’re going to be out of solid contact for a while, but you’d like to monitor your CPU usage (so you can make sure to SSH in and fix something if the CPUs go idle, indicating a simulation crash.)

Solution: a quick script to email me my CPU load every hour. Then all my sessions are on screen, so I can SSH in with my phone and edit/restart what I need over 3G. If it looks bad, I’ll know to get to a real net connection ASAP.

Here’s the script (requires sudo apt-get install sendemail)

#!/bin/bash

while true; do
    echo `uptime` | sendemail -f abarry@abarry.org -t abarry@abarry.org -u "Uptime report (auto)"

    sleep 3600
done