User Tools

Site Tools


cron-apt

Ho modificato il file config in /etc/cron-apt, adesso devo verificare che funzioni, cioè che alle 4 di ogni notte faccia l'update dei depositi security, che nel frattempo ho scorporato dal sources.list principale.

Ho utilizzato questo sito:

http://blog.pastoutafait.org/billets/Mise-%C3%A0-jour-automatique-avec-Cron-APT

Sembra che funzioni bene: oggi, 12 luglio 2012, ho trovato questo nella mail in /var/mail/francesco:

Date: Thu, 12 Jul 2012 04:06:25 +0200
From: root <root@serverhp>
To: root@serverhp
Subject: CRON-APT completed on serverHP [/etc/cron-apt/config]

CRON-APT RUN [/etc/cron-apt/config]: Thu Jul 12 04:00:01 CEST 2012
CRON-APT SLEEP: 382, Thu Jul 12 04:06:23 CEST 2012
CRON-APT ACTION: 0-update
CRON-APT LINE: /usr/bin/apt-get update -o quiet=2
CRON-APT ACTION: 3-download
CRON-APT LINE: /usr/bin/apt-get autoclean -y
Reading package lists...
Building dependency tree...
Reading state information...
Del libnet-cidr-perl 0.13-1 [15.1 kB]
Del libphp-simplepie 1.2-1 [70.2 kB]
Del libpdf-reuse-barcode-perl 0.05-1 [15.5 kB]
Del libhtml-tagset-perl 3.20-2 [13.5 kB]
Del liblingua-stem-perl 0.84-1 [1394 kB]
Del libswscale0 5:0.7.13-dmo2 [109 kB]
Del nginx-full 1.1.19-1~bpo60+1 [423 kB]
Del libdatetime-format-dateparse-perl 0.05-1 [8246 B]
Del libdatetime-timezone-perl 1:1.20-1+2010k [387 kB]
Del libxml-sax-writer-perl 0.52-1 [24.0 kB]
Del libcroco3 0.6.2-1 [125 kB]
Del libidzebra-2.0-mod-grs-regx 2.0.44-2 [240 kB]
Del libdevel-stacktrace-perl 1.2100-1 [16.4 kB]
Del libemail-date-perl 1.103-2 [8274 B]
Del libmarc-xml-perl 0.92-1 [22.8 kB]
Del liblist-moreutils-perl 0.25~02-1 [64.2 kB]
Del libdatetime-format-mail-perl 0.3001-1 [14.5 kB]
Del libtext-csv-xs-perl 0.73-1 [74.4 kB]
Del libdbd-sqlite2-perl 2:0.33-9 [201 kB]
Del libhtml-parser-perl 3.66-1 [115 kB]
Del libdatetime-perl 2:0.6100-2 [106 kB]
Del libnumber-format-perl 1.73-1 [31.3 kB]
[...]
Del libemail-date-format-perl 1.002-1 [6258 B]
Del libset-infinite-perl 0.63-1 [45.7 kB]
Del idzebra-2.0-utils 2.0.44-2 [250 kB]
Del libreadonly-perl 1.03-2 [19.5 kB]
Del xmlstarlet 1.0.2-1 [171 kB]
Del libmarc-charset-perl 1.2-1 [953 kB]
Del liblocale-currency-format-perl 1.28-1 [15.9 kB]
Del libemail-simple-perl 2.100-1 [22.8 kB]
Del libxml-dumper-perl 0.81-1 [23.0 kB]
Del libemail-abstract-perl 3.002-1 [24.4 kB]
Del ffmpeg 5:0.7.13-dmo2 [365 kB]
Del libdatetime-locale-perl 1:0.45-1 [2276 kB]
Del yaz 4.0.11-1 [149 kB]
Del libidzebra-2.0-mod-grs-marc 2.0.44-2 [237 kB]
Del libstring-crc32-perl 1.4-2+b1 [11.1 kB]
Del libhttp-oai-perl 3.23-1 [102 kB]
Del libpdf-table-perl 0.9.3-3 [29.9 kB]
Del libcommon-sense-perl 3.3-1 [21.8 kB]
Del libclass-accessor-chained-perl 0.01.1~debian-2.1 [8008 B]
Del git 1:1.7.2.5-3 [5274 kB]
Del libavformat52 5:0.7.13-dmo2 [463 kB]
Del sgml-data 2.0.4 [284 kB]
Del tinymce2 2.1.3-1 [448 kB]
Del libbusiness-isbn-perl 2.05-1 [22.1 kB]
Del libpdf-api2-perl 0.73-1 [3979 kB]
Del cron-apt 0.8.2 [27.0 kB]
Del docbook-xsl 1.75.2+dfsg-5 [1627 kB]
Del libxml-sax-perl 0.96+dfsg-2 [86.0 kB]
Del libjson-xs-perl 2.290-1 [91.7 kB]
Del libmemoize-memcached-perl 0.03-1 [11.4 kB]
Del libbusiness-isbn-data-perl 20081208-1 [13.5 kB]
CRON-APT LINE: /usr/bin/apt-get dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Il cron-job viene lanciato intorno alle 4 di notte, per default.


Dopo aver fatto questa modifica:

Automatiser l'installation des mises à jour

Pour installer automatiquement les mises à jour disponibles, il faut créer un fichier nommé “5-install” dans le répertoire “/etc/cron-apt/action.d/”. Ajoutez la ligne suivante dans ce fichier :

dist-upgrade -y -o APT::Get::Show-Upgraded=true

Et voilà, les mises à jour seront installées automatiquement.

Notez que ce comportement n'est pas recommandé sur un serveur ! Il est préférable de faire les mises à jour à la main pour éviter toutes indisponibilités d'un service suite à un problème avec la nouvelles version installée.

Nel mio caso:

francesco@serverHP:/etc/cron-apt/action.d$ ll
total 12K
-rw-r--r-- 1 root root 18 22 août   2010 0-update
-rw-r--r-- 1 root root 64 22 août   2010 3-download
-rw-r--r-- 1 root root 48 26 juil. 08:39 5-install

ho trovo il report così strutturato:

Date: Fri, 27 Jul 2012 04:40:18 +0200
From: root <root@serverhp>
To: root@serverhp
Subject: CRON-APT completed on serverHP [/etc/cron-apt/config]

CRON-APT RUN [/etc/cron-apt/config]: Fri Jul 27 04:00:01 CEST 2012
CRON-APT SLEEP: 2398, Fri Jul 27 04:40:00 CEST 2012
CRON-APT ACTION: 0-update
CRON-APT LINE: /usr/bin/apt-get update -o quiet=2
CRON-APT ACTION: 3-download
CRON-APT LINE: /usr/bin/apt-get autoclean -y
Reading package lists...
Building dependency tree...
Reading state information...
CRON-APT LINE: /usr/bin/apt-get dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
  isc-dhcp-client isc-dhcp-common libnss3-1d openjdk-6-jre
  openjdk-6-jre-headless openjdk-6-jre-lib
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 620 kB/33.4 MB of archives.
After this operation, 381 kB of additional disk space will be used.
Get:1 http://security.debian.org/ squeeze/updates/main isc-dhcp-client amd64
+4.1.1-P1-15+squeeze4 [281 kB]
Get:2 http://security.debian.org/ squeeze/updates/main isc-dhcp-common amd64
+4.1.1-P1-15+squeeze4 [339 kB]
Fetched 620 kB in 0s (666 kB/s)
Download complete and in download only mode
CRON-APT ACTION: 5-install
CRON-APT LINE: /usr/bin/apt-get dist-upgrade -y -o APT::Get::Show-Upgraded=true
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
  isc-dhcp-client isc-dhcp-common libnss3-1d openjdk-6-jre
  openjdk-6-jre-headless openjdk-6-jre-lib
Reading changelogs...
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/33.4 MB of archives.
After this operation, 381 kB of additional disk space will be used.
(Reading database ... 43671 files and directories currently installed.)
Preparing to replace isc-dhcp-client 4.1.1-P1-15+squeeze3 (using
+.../isc-dhcp-client_4.1.1-P1-15+squeeze4_amd64.deb) ...
Unpacking replacement isc-dhcp-client ...
Preparing to replace isc-dhcp-common 4.1.1-P1-15+squeeze3 (using
+.../isc-dhcp-common_4.1.1-P1-15+squeeze4_amd64.deb) ...
Unpacking replacement isc-dhcp-common ...
Preparing to replace libnss3-1d 3.12.8-1+squeeze4 (using
+.../libnss3-1d_3.12.8-1+squeeze5_amd64.deb) ...
Unpacking replacement libnss3-1d ...
Preparing to replace openjdk-6-jre-lib 6b18-1.8.13-0+squeeze1 (using
+.../openjdk-6-jre-lib_6b18-1.8.13-0+squeeze2_all.deb) ...
Unpacking replacement openjdk-6-jre-lib ...
Preparing to replace openjdk-6-jre-headless 6b18-1.8.13-0+squeeze1 (using
+.../openjdk-6-jre-headless_6b18-1.8.13-0+squeeze2_amd64.deb) ...
Unpacking replacement openjdk-6-jre-headless ...
Preparing to replace openjdk-6-jre 6b18-1.8.13-0+squeeze1 (using
+.../openjdk-6-jre_6b18-1.8.13-0+squeeze2_amd64.deb) ...
Unpacking replacement openjdk-6-jre ...
Processing triggers for man-db ...
Processing triggers for hicolor-icon-theme ...
Setting up isc-dhcp-common (4.1.1-P1-15+squeeze4) ...
Setting up isc-dhcp-client (4.1.1-P1-15+squeeze4) ...
Setting up libnss3-1d (3.12.8-1+squeeze5) ...
Setting up openjdk-6-jre-headless (6b18-1.8.13-0+squeeze2) ...
Setting up openjdk-6-jre-lib (6b18-1.8.13-0+squeeze2) ...
Setting up openjdk-6-jre (6b18-1.8.13-0+squeeze2) ...
cron-apt.txt · Last modified: 2012/07/27 12:06 by admin