Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic:  Date of latest d-u  (Read 2461 times)

mylo

  • Guest
Date of latest d-u
« on: 2015/10/05, 23:23:33 »
Hi all,

how can I find out when I made the last d-u on my installation?
« Last Edit: 2015/10/05, 23:47:51 by mylo »

Offline piper

  • User
  • Posts: 1.785
  • we are the priests ... of the temples of syrinx
Re: Date of latest d-u
« Reply #1 on: 2015/10/06, 01:15:10 »
/var/log/apt/history.log
Free speech isn't just fucking saying what you want to say, it's also hearing what you don't want to fucking hear

I either give too many fucks or no fucks at all, it's like I cannot find a middle ground for a moderate fuck distribution, it's like what the fuck

Offline musca

  • User
  • Posts: 725
  • sid, fly high!
Re: Date of latest d-u
« Reply #2 on: 2015/10/06, 12:18:07 »
Hello,
you can have a script reading the log for you.

Code: [Select]
$ awk 'BEGIN {latest="not yet this month"} /dist-upgrade/ { latest=last"  "$0;} { last=$0; } END { print latest }' /var/log/apt/history.log
Start-Date: 2015-10-05  23:46:46  Commandline: apt dist-upgrade

Code: [Select]
$ perl -wlne 'BEGIN {$latest="not yet this month"} /dist-upgrade/ and $latest="$last  $_"; $last=$_; END { print $latest }' /var/log/apt/history.log
Start-Date: 2015-10-05  23:46:46  Commandline: apt dist-upgrade

That perl example seems to imitate the awk style. I'm sure there are other solutions, that are more "perlish".

greetings
musca
„Es irrt der Mensch, solang er strebt.“  (Goethe, Faust)

Offline der_bud

  • User
  • Posts: 1.072
  • member
Re: Date of latest d-u
« Reply #3 on: 2015/10/06, 13:58:35 »
Uh, those look very awkish and perlish for my simple mind ;) . I generate a bit more output with
Code: [Select]
grep 'dist-upgrade' /var/log/apt/history.log -a1 If too much, could be followed by |tail -2 ).
Du lachst? Wieso lachst du? Das ist doch oft so, Leute lachen erst und dann sind sie tot.

Offline musca

  • User
  • Posts: 725
  • sid, fly high!
Re: Date of latest d-u
« Reply #4 on: 2015/10/07, 01:59:30 »
agreed, you don't need awk or perl when you have bash.

Code: [Select]
$ (latest="not yet this month"; while read line; do [[ $line =~ dist-upgrade ]] && latest="$last $line"; last="$line "; done ; printf "$latest\n") </var/log/apt/history.log
Start-Date: 2015-10-05  23:46:46  Commandline: apt dist-upgrade

and you can do it with lua:
Code: [Select]
$ lua -e 'latest="not yet this month"; for line in io.lines() do if string.find(line,"dist%-upgrade") then latest=last.."  "..line end last=line end io.write(latest.."\n")' </var/log/apt/history.log
Start-Date: 2015-10-05  23:46:46  Commandline: apt dist-upgrade

greetings
musca
« Last Edit: 2015/10/07, 03:42:58 by musca »
„Es irrt der Mensch, solang er strebt.“  (Goethe, Faust)

mylo

  • Guest
Re: Date of latest d-u
« Reply #5 on: 2015/10/07, 19:28:13 »
Thanks for your hinter, I will try all of them!