Recently, I have been running a command to migrate contacts from Zimbra to Google and this command takes a long time to run. In addition, I kept getting unexpected errors I had to fix due to misformatted data. Sometimes it would run 10 minutes and then die or run 30 minutes and then die. I wanted a way to track this command and get alerted when it finished either from an error or not. That lead me to writing track. Track is a command wrapper that times how long the command took to run and sends an SMS when it finishes or errors out.
Before using track you will need an account on Twilio (it is the service to send the SMS message). After that you can install track via pip.
pip install git+git://github.com/specialkevin/track.git
Now you need to setup environment variables that hold your API auth code and token for Twilio.
echo "export TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXX" >> ~/.bashrc echo "export TWILIO_AUTH_TOKEN=YYYYYYYYYYYYYYYYYY" >> ~/.bashrc
After you have those environment variables setup you need to setup the environment variables that hold the phone number given to you by Twilio and the phone number you want SMS alerts sent to from track.
echo "export TWILIO_PHONE_NUMBER=+11234567890" >> ~/.bashrc echo "export TRACK_PHONE_NUMBER=+11234567890" >> ~/.bashrc
Now you have track all setup and ready to go.
track "ping -c 10 google.com"
You must wrap the command you want to track in quotes or else you will get complaints about invalid number of arguments.Tweet