Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a clean way to detect when apt-get upgrade or apt-get dist-upgrade was last run on an Ubuntu Server?

If there isn't a way to do this by default, where would be the best place to modify a script in order to track when apt-get upgrade or apt-get dist-upgrade has last been run.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

The log file you are searching is: /var/log/apt/history.log

Here are 2 log entries:

Start-Date: 2014-04-15  14:15:35
Commandline: apt-get install python3-tk
Install: libxcb-dri2-0:amd64 (1.9.1-3ubuntu1, automatic), x11-utils:amd64 (7.7+1, automatic), tk8.5-lib:amd64 (8.5.11-2ubuntu4, automatic), tcl8.5-lib:amd64 (8.5.13-1ubuntu4, automatic), libllvm3.3:amd64 (3.3-5ubuntu4, automatic), libgl1-mesa-dri:amd64 (9.2.1-1ubuntu3, automatic), libglapi-mesa:amd64 (9.2.1-1ubuntu3, automatic), libtxc-dxtn-s2tc0:amd64 (0~git20121227-1, automatic), libxv1:amd64 (1.0.9-1, automatic), libutempter0:amd64 (1.1.5-4build1, automatic), libxss1:amd64 (1.2.2-1, automatic), libxcb-glx0:amd64 (1.9.1-3ubuntu1, automatic), libgl1-mesa-glx:amd64 (9.2.1-1ubuntu3, automatic), libdrm-nouveau2:amd64 (2.4.46-1ubuntu1, automatic), libxcb-shape0:amd64 (1.9.1-3ubuntu1, automatic), blt:amd64 (2.4z-7, automatic), tk8.5:amd64 (8.5.11-2ubuntu4, automatic), tcl8.5:amd64 (8.5.13-1ubuntu4, automatic), xterm:amd64 (278-1ubuntu3, automatic), libxxf86vm1:amd64 (1.1.3-1, automatic), libelf1:amd64 (0.157-1ubuntu1, automatic), libxxf86dga1:amd64 (1.1.4-1, automatic), python3-tk:amd64 (3.3.1-0ubuntu2)
End-Date: 2014-04-15  14:15:44


Start-Date: 2014-04-23  11:10:37
Commandline: apt-get dist-upgrade
Upgrade: mysql-server-core-5.5:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), mysql-server-5.5:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), mysql-client-core-5.5:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), mysql-client-5.5:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), mysql-common:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), libmysqlclient18:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), python3-distupgrade:amd64 (0.205.5, 0.205.6), mysql-server:amd64 (5.5.35-0ubuntu0.13.10.2, 5.5.37-0ubuntu0.13.10.1), ubuntu-release-upgrader-core:amd64 (0.205.5, 0.205.6)
End-Date: 2014-04-23  11:11:10
share|improve this answer
add comment

Your Answer

 
discard

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.