You are not logged in.

#1 2020-04-25 17:37:38

cormanthor
Member
Registered: 2009-11-21
Posts: 10

[SOLVED] Can Archey show me when Pacman -Syu was last run?

I've seen in the /var/log/pacman.log file that I can 'grep PACMAN' and pipe to tail to find the info manually.

What I'm looking to do is display this info in Archey every time I open a terminal window.  Any advice? or is there another terminal eye-candy script that has this feature?

Last edited by cormanthor (2020-04-25 21:18:03)

Offline

#2 2020-04-25 17:48:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,519
Website

Re: [SOLVED] Can Archey show me when Pacman -Syu was last run?

Archey is just a script.  You could modify it to add this if you wanted.  Or just add another line in your shell rc to display this information however you wanted before/after archey (even using ansi sequences to overlay it or position it relative to the archey output.)

Note that you can also get the last update time efficiently from `stat -c %y /var/lib/pacman/sync/*.db`.

E.g., replace follow archey3 in your shellrc/profile with the printf line below:

printf '\033[s\033[8A\033[32C\033[34;1mLast Update: \033[0m%s\033[u' \
	"$(stat -c %y /var/lib/pacman/sync/*.db | sort | tail -1)"

You could also put the stat result through 'date -d' for changing the time format.  Or if you are ok with a fair assumption that [community] tends to get the most frequent updates you could use date -r with any format, e.g.

printf '\033[s\033[8A\033[32C\033[34;1mLast Update: \033[0m%s\033[u' \
	"$(date -r /var/lib/pacman/sync/community.db +%D)"

Last edited by Trilby (2020-04-25 18:03:09)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2020-04-25 19:07:24

cormanthor
Member
Registered: 2009-11-21
Posts: 10

Re: [SOLVED] Can Archey show me when Pacman -Syu was last run?

I've looked all over the place and can't find the references to break down the escape sequence you referenced to move the resulting output up about 6 lines. Is there a guide I could find somewhere or a better search term to use? I'm looking to move the result to match my Archey config.

Thanks again!

Offline

#4 2020-04-25 19:52:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,519
Website

Re: [SOLVED] Can Archey show me when Pacman -Syu was last run?

You can check the wikipedia page on ansi sequences.  My example was with the stock archey - I don't know how much it can chage with other configurations.  If you really just need to move the "Last Update" line up, then change the 8 betweel '\033[' and 'A' to a higher number.  "\033[8A" moves the cursor up 8 lines, "\033[9A" would move it up 9 lines, etc.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2020-04-25 21:17:36

cormanthor
Member
Registered: 2009-11-21
Posts: 10

Re: [SOLVED] Can Archey show me when Pacman -Syu was last run?

Thank you very much!

Offline

#6 2020-04-25 22:32:52

cormanthor
Member
Registered: 2009-11-21
Posts: 10

Re: [SOLVED] Can Archey show me when Pacman -Syu was last run?

My final script at the end of my ~/.bashrc is

archey3 --config=~/.config/archey3.cfg
printf '\033[s\033[1A\033[32C\033[35;1mDays Since Last Update:\033[0m%s\033[u ' \ "$(( ($(date +%s) - $(date -r /var/lib/pacman/sync/community.db +%s) )/(60*60*24) ))"

I have my Archey config set for magenta (35) and aligned to bottom (1A)
Thanks again for all the help.

Offline

Board footer

Powered by FluxBB