I need to add a cron job thru a script I run to set up a server. I am currently using Ubuntu. I can use crontab -e
but that will open an editor to edit the curr
Crontab files are simply text files and as such can be treated like any other text file. The purpose of the crontab
command is to make editing crontab files safer. When edited through this command, the file is checked for errors and only saved if there are none.
crontab [path to file]
can be used to specify a crontab stored in a file. Like crontab -e
, this will only install the file if it is error free.
Therefore, a script can either directly write cron tab files, or write them to a temporary file and load them with the crontab [path to temp file]
command. Writing directly saves having to write a temporary file, but it also avoids the safety check.