rtucker / linode-recent-jobs

Displays the job queue for a Linode via API. Can be used to display most recent boot job (useful in rc.local).

This URL has Read+Write access

name age message
file .gitignore Tue Aug 04 18:10:48 -0700 2009 including api.py in here to make life easy [rtucker]
file .gitmodules Wed Aug 26 11:57:34 -0700 2009 Moving from embedding to submoduling the API bi... [rtucker]
file COPYRIGHT Tue Aug 04 17:12:42 -0700 2009 adjusting docs [rtucker]
file README Loading commit data...
submodule api - 83e32de Wed Aug 26 11:57:34 -0700 2009 Moving from embedding to submoduling the API bi... [rtucker]
file recentjobs.py Sun Nov 29 18:28:40 -0800 2009 only return the last bootjob that succeeded [rtucker]
file secrets.py.orig Tue Aug 04 17:11:25 -0700 2009 initial commit [rtucker]
README
This is a handy script to print out the recent jobs for a given Linode.
I use it to send news at boottime so I know why my Linode rebooted:

(in rc.local)
    echo -n "Sending startup mail... "
    /path/to/linode-recent-jobs/recentjobs.py --linode-id=1234 --all-jobs | mail -s "`hostname` reboot `date`" root
    /path/to/linode-recent-jobs/recentjobs.py --linode-id=1234 | mail mycellphone@example.com
    echo "done."

You need to specify an API key always, and a Linode ID for everything other
than --list-linodes (which will show you your Linode ID).  You can either
specify them on the command line with --api-key= or --linode-id= respectively,
or hard-code them in secrets.py (see secrets.py.orig for example).

Note: Be sure to "git submodule init" and "git submodule update" to pull
in the Python API bindings.

Usage: recentjobs.py [options]

Options:
  -h, --help            show this help message and exit
  -a, --all-jobs        Display a list of all jobs in the job history.
  -l, --last-boot       Display the timestamp and reason of the last boot.
                        (default)
  -K APIKEY, --api-key=APIKEY
                        Specify the API key (can also put in secrets.py).
  -I LINODEID, --linode-id=LINODEID
                        Specify the Linode ID (can also put in secrets.py).
  --list-linodes        List Linode IDs associated with this account.