Here is a quick tip for setting up automatic updates using cron. I've used "apt-get" in my post, but you can use "aptitude" instead, or any other distribution upgrade command.
Create a new cron job:
and enter:
After finishing editing the cron job, press Ctrl + O (Write out) and then Ctrl + X (Exit).
"0 4 * * *" means every day at 4 AM. If you don't know to use cron, you will find a graphical explanation, HERE.
Here is another example -> run the upgrade every hour (of course, it will only upgrade if there are new updates):
Another way of using this (actually the way I'm using it) is to simply run the command with the "-d" parameter, which means download the upgrades, but don't do anything. So when you decide to run "sudo apt-get upgrade" (or "dist-upgrade"), you don't have to wait to download the packages. Here is such a cron job which runs every hour and only downloads the upgrades, without installing them:
If you have missing GPG keys, the command will not work. You must also add "--force-yes" next to "-y", like so:
sudo crontab -e
and enter:
0 4 * * * (apt-get update && apt-get -y dist-upgrade) > /dev/null
After finishing editing the cron job, press Ctrl + O (Write out) and then Ctrl + X (Exit).
"0 4 * * *" means every day at 4 AM. If you don't know to use cron, you will find a graphical explanation, HERE.
Here is another example -> run the upgrade every hour (of course, it will only upgrade if there are new updates):
0 * * * * (apt-get update && apt-get -y dist-upgrade) > /dev/null
Another way of using this (actually the way I'm using it) is to simply run the command with the "-d" parameter, which means download the upgrades, but don't do anything. So when you decide to run "sudo apt-get upgrade" (or "dist-upgrade"), you don't have to wait to download the packages. Here is such a cron job which runs every hour and only downloads the upgrades, without installing them:
0 * * * * (apt-get update && apt-get -y -d upgrade) > /dev/null
If you have missing GPG keys, the command will not work. You must also add "--force-yes" next to "-y", like so:
apt-get -y --force-yes -d upgrade
Tidak ada komentar:
Posting Komentar