Answers for "create cron job using shell script"

1

bash add new line to crontab

#!/bin/bash

line="* * * * * /path/to/command"
(crontab -u userhere -l; echo "$line" ) | crontab -u userhere -
Posted by: Guest on November-16-2020
3

create cron job from command line

#write out current crontab
crontab -l > mycron
#echo new cron into cron file
echo "00 09 * * 1-5 echo hello" >> mycron
#install new cron file
crontab mycron
rm mycron
Posted by: Guest on January-28-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language