I need to add a line to a user's crontab file. Normally, I would do this with
crontab -e, but I want to do it with a provisioning script.
Any clever methods?
...or (although directly editing crontab files is not recommended):
(Assuming your provisioning script is running as root.)
There are a few ways
This will work if you want the user to edit it
If you don't want the user to edit it.. I'd drop a file into /etc/cron.d that is like
You can call it whatever you want.
You could directly add new crons (if you have root privileges). you can also specify the run-as user.