I simply want a script that runs a few update commands. I want them to happen at 3am every day.
I cannot figure out why they don't work. I added this like to crontab -e
0 3 * * * root /etc/cron.custom/update
The script in the update file is
#!/bin/bash
# if not root, run as root
if (( $EUID != 0 )); then
sudo /home/jb/bash/update.sh
exit
fi
apt-get update
dietpi-update
apt-get -y upgrade
apt-get -y dist-upgrade
apt-get clean
apt-get -y autoremove
reboot
I don't know how to make scripts so I found that off the internet. It is surprisingly hard to find any answers on how to edit anything to do with cron.
Unattended upgrades doesn't upgrade everything so before anyone recommends it I tried it already and it missed heaps constantly.
In short how do I auto update and upgrade my device?
Running Debian (DietPi).
cron
sends the result of the command there./etc/cron.daily
. that's all, no need to edit any crontab files.