i am trying to write a script that will download, enable and add task with cron and then add auto update and upgrade task to the machine.
what i have until now is
sudo apt install cron
sudo systemctl enable cron
until here all good then i add (after a research, the following commands)
<(crontab -l) <(echo '50 19 * * * sudo apt update -y') | crontab -
<(crontab -l) <(echo '00 20 * * * sudo apt upgrade -y') | crontab -
and when i check the file crontab -l
i see that the script did write the task like it should, but its not runing (i tried to run an apt install every min to see if its working)
but when i write the this command 50 19 * * 3 root sudo apt update -y
with nano on that file /etc/crontab
it worked
i tried to add root permeation on crontab -e
but still not working
any solution?
is there is a way to add text line with script to /etc/crontab
? ( i couldn't find a way on line)
thanks you all
<(crontab -l)
and<(echo ...)
, and then feed that into cron using... some incantation of the crontab command.