I have a script thar I want to be executed each first minute of each hour. Thus, i made a second file named crontab.sh:

$ cat crontab.sh
#cript path

# Add the cron job to run the script at the first minute of each hour
(crontab -l ; echo "1 * * * * $script_path") | crontab -

echo "Cron job added to run the script at the first minute of each hour."

I executed crontab.sh.

Finally. the desired script runs successfully at the first minute of each hour.

Suppose in the near future I want to delete this rule. Should I just delete the crontab.sh file? Also, suppose I want the script to be executed in the nineth minute each hour. Editing crontab.sh file will delete the first rule and will create a second one.

1 Answer 1


No, don't delete your crontab.sh file but if you want to remove the execution just remove the according line while using crontab -e it will edit the crontab using your preferred EDITOR. You can backup before your existing crontab using crontab -l > /tmp/file

  • Thus, I don't need to execute any file to create a new crontab, just passing it with crontab -e. Perfectly, thanks. Commented Jun 1 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .