How to automatically create a cron task with shell commands without interaction

How to automatically create a cron task with shell commands without interaction

#Write out the current crontab
crontab -l > mycron

#Write the new cron to the cron file

echo "00 09 * * 1-5 echo hello" >> mycron

#Install the new cron file
crontab mycron
rm mycron

#Restart cron:
service cron restart


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *