Yes, I'm aware of unattended-upgrade, but I don't like that package's limitations. I've got a PHP script that makes the following calls:
... system("/usr/bin/apt-get update"); system("/usr/bin/apt-get -y upgrade 2>&1 > /tmp/apt_get.txt"); system("/usr/bin/apt-get autoremove"); system("/usr/bin/apt-get autoclean"); ...
The script is set up via cron to run automatically on a schedule. It appears to execute all of the commands correctly as root. However, 'apt-get -y upgrade' doesn't actually perform the upgrade as evidenced here in the output of /tmp/apt_get.txt:
Reading package lists... Building dependency tree... Reading state information... The following packages will be upgraded: iproute 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 444 kB of archives. After this operation, 1,024 B of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main iproute amd64 20111117-1ubuntu2.3 [444 kB] Fetched 444 kB in 1s (374 kB/s)
Manually running 'apt-get upgrade' shows that the package was downloaded but not installed:
Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: iproute 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/444 kB of archives. After this operation, 1,024 B of additional disk space will be used. Do you want to continue [Y/n]? n Abort.
So apt-get successfully downloads the package but doesn't actually perform the upgrade. What do I need to change to get this script to work as expected? It almost seems like a bug in "apt-get -y upgrade" itself. (Running Ubuntu 12.04.4 LTS here.)