create a crontab via script
How do you create a crontab entry via a Bash script? That’s a good question. Here is one solution:
(crontab -l 2>/dev/null; echo "* 11 * * * /path/to/job -with args") | crontab -
If you want to run it as a specific user, use the following:
(crontab -l -u user 2>/dev/null; echo "* 11 * * * /path/to/job -with args") | crontab -