0

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

#!/bin/sh
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?

3
  • 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, 2013 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, 2013 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, 2013 at 12:05

2 Answers 2

0

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

2
  • So by using the script above but changing it to include updates ?
    – Grimlockz
    Jan 9, 2013 at 12:03
  • If you run apt-get update && apt-get upgrade --assume-yes it should install whatever upgrades you have pending. Jan 9, 2013 at 12:09
0

try using cron-apt, here is my config:

APTCOMMAND=/usr/bin/aptitude # or /usr/bin/apt-get
MAILON="always"
SYSLOGON="upgrade"
MAILTO="[email protected]"
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
clean

hope that will help ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .