Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to work out the best way to run unattended upgrades every Thursday at 3am but can only see a way to run this weekly but not a given time.

I thought of one way would be to have a script that is called by cron on Thursday at 3am

The below script would work just for security updates

sh -c 'grep precise-security /etc/apt/sources.list > /etc/apt/secsrc.list'
sh -c 'apt-get -o Dir::Etc::sourcelist="secsrc.list" \
-o Dir::Etc::sourceparts="-" update && \
apt-get --assume-yes upgrade'

Any thoughts on another way?

share|improve this question
Cron is specifically intended for running things unattended at certain times on certain days. Is there any reason not to use it, as you clearly have considered? – MadHatter Jan 9 '13 at 11:59
I think I must be missing something as I can't see how to use unattended upgrades with cron other then using a script like above, thanks – Grimlockz Jan 9 '13 at 12:03
So use the script above! Seriously, if it works, and it's using standard infrastructure like cron, it's probably fine! – MadHatter Jan 9 '13 at 12:05
up vote 0 down vote accepted

What wrong with doing it this way? If you just add a cron rule 0 3 * * Thu USERNAME SCRIPT it should work fine.

share|improve this answer
So by using the script above but changing it to include updates ? – Grimlockz Jan 9 '13 at 12:03
If you run apt-get update && apt-get upgrade --assume-yes it should install whatever upgrades you have pending. – Tim Lamballais Jan 9 '13 at 12:09

try using cron-apt, here is my config:

APTCOMMAND=/usr/bin/aptitude # or /usr/bin/apt-get
OPTIONS="-o quiet=2"

and actions.d/3-download i modified:

autoclean -y
dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
upgrade -y -o APT::Install-Recommends=false -o APT::Install-Suggests=false
dist-upgrade -y -o APT::Install-Recommends=false -o APT::Install-Suggests=false

hope that will help ;)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.