Reworked to remove the reliance on keyring, which is useless under cron.
Got this working well now for running both interactively and under cron.
Updated the docs to reflect the code changes.