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?

MadHatter
  • 79,770
  • 20
  • 184
  • 232
Grimlockz
  • 325
  • 1
  • 2
  • 11
  • 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 09 '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 09 '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 09 '13 at 12:05

2 Answers2

0

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

Tim Lamballais
  • 136
  • 1
  • 6
0

try using cron-apt, here is my config:

APTCOMMAND=/usr/bin/aptitude # or /usr/bin/apt-get
MAILON="always"
SYSLOGON="upgrade"
MAILTO="ruslanas.gzibovskis@ittc.vu.lt"
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 ;)

BiG_NoBoDy
  • 138
  • 1
  • 8