Refactor crontab generation.

This also adds the ability to generate the crontab from the command
line.
Always return the original crontab if there was an error