You are not logged in.

#1 2021-08-03 14:07:36

MountainX
Member
Registered: 2016-02-08
Posts: 360

How to find last date of pacman full system update (scripting)?

I would like to have a bash script that can run on various Arch devices and return the duration (such as number of minutes, hours, days, etc.) since the last full system upgrade was performed with pacman. (Or maybe just the last update of any type.)

I cannot rely upon file dates in /var/cache/pacman because that points to a shared resource.

The only idea I have so far is to parse the date from the value returned by `uname -a` but I suspect there's a much better option. Can anyone suggest one?

Offline

#2 2021-08-03 14:14:26

seth
Member
Registered: 2012-09-03
Posts: 25,071

Re: How to find last date of pacman full system update (scripting)?

Like

grep 'starting full system upgrade' /var/log/pacman.log | tail -1

?

Online

#3 2021-08-03 14:15:45

MountainX
Member
Registered: 2016-02-08
Posts: 360

Re: How to find last date of pacman full system update (scripting)?

seth wrote:

Like

grep 'starting full system upgrade' /var/log/pacman.log | tail -1

?

Yes, exactly like that. Thank you.

Offline

#4 2021-08-03 14:17:23

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 17,974

Re: How to find last date of pacman full system update (scripting)?

The information you need will be in /var/log/pacman.log.  You will need to do some processing on it.

A really crude example might be

grep Syu /var/log/pacman.log | tail -1

Edit:  Wow.  Was I slow.

Last edited by ewaller (2021-08-03 14:18:43)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB