I want to be able to programatically add a new cron job, what is the best way to do this?
From my research, it seems I could dump the current crontab and then append a new one, piping that back into crontab:
(crontab -l ; echo "0 * * * * wget -O - -q http://www.example.com/cron.php") | crontab -
It's always worked well for me.
You should consider a slightly more sophisticated script that can do three things.
Append a crontab line; assuring that it didn't exist. Adding when it already exists is bad.
Remove the crontab line. Perhaps only warning if it didn't exist.
A combination of the above two features to replace the crontab line.