You are not logged in.
Hi people,
My question is how to get this information for show in Conky:
- KDE version.
- Last sync (pacman -Sy) and Last update (pacman -Su)
For the first point could be use a script that execute $ kdesu --version and get information from there.
I have no idea how get information from pacman (may be logs?).
Any ideas?
Thank you.
Offline
grep 'system upgrade' /var/log/pacman.log | tail -1 | sed -e 's/s.*//'
grep 'synchronizing' /var/log/pacman.log | tail -1 | sed -e 's/s.*//'
There might be a more elegant way of doing that, but it's what I do.
btw, this probably shouldn't be in the Artwork and Screenshots section...
Last edited by splittercode (2010-04-19 01:22:41)
Offline
Thank you, I will try on.
For the kde version I did this:
kdesu --version print this:
$ kdesu --version
Qt: 4.6.2
KDE Development Platform: 4.4.2 (KDE 4.4.2)
KDE su: 1.0
Then I make a script with
#!/usr/bin/perl
use strict;
use warnings;
my @lines = (`kdesu --version` );
my $temp = substr("$lines[1]",37,5);
print $temp
4.4.2
How move this topic to the right place?. Wich would be?
Last edited by Horris (2010-04-19 01:38:02)
Offline
How move this topic to the right place?. Wich would be?
I dunno, I've never made a thread before.. I think maybe a moderator will have to do it
Offline
here is a modification of the previous command that will give you year-mo-day
grep 'system upgrade' /var/log/pacman.log | tail -1 | grep -oe [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
2010-04-13
grep 'synchronizing' /var/log/pacman.log | tail -1 | grep -oe [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
2010-04-13
--empthollow
Check out my Arch based live distro http://fluxcapacity.99k.org
Offline
How bout this?
#!/bin/bash
TODAY=$(date +"%Y-%m-%d")
LASTUPDATE=$(grep 'synchronizing' /var/log/pacman.log | tail -1 | grep -oe [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])
tmpDays=$( printf '%s' $(( $(date -u -d"$TODAY" +%s) - $(date -u -d"$LASTUPDATE" +%s))) )
days=$(( $tmpDays / 60 / 60 / 24 ))
echo "$days" &
Stuck empthollow's command into a bash script I already use for other purposes, should give you days since last update as output (which for me is zero right now).
Obviously, you can replace 'synchronizing' with 'system upgrade' for -Su.
Last edited by splittercode (2010-04-19 03:09:09)
Offline
Side concern, don't you think grepping through /var/log/pacman.log (1.1MB on my current machine) repeatedly would both kill your hard disk as well as your battery?
Some type of pacman 'hook' which is run on every pacman command to update a file to the latest date-stamp would be easier on resources I think. No idea if pacman has any support for hooks.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
Use tail on the logfile before doing the grep if you are that worried? Though even on the worst computer arch could run on grep does pretty well on that 'large' of file.
You could also use a file alteration library to check the file, such as those in inotify-tools (which includes the programs inotifywait and inotifywatch) instead of polling it with greps/tails/whatever.
Offline
Well, in conky and most other system monitor tools that you'd use these in(ex. status bars in tiling wm's) you can set scripts to run/update however often you want. I can't imagine running it once every 2-3 hours would have any noticeable effect.
Offline
@splittercode - you're absolutely right, but I'm operating from the geek perspective of 'if it changes I want to know NOW', where 2-3 hours polling interval basically means 2-3 hours potential delay in being informed.
@Kiwi - Didn't think about file alteration notifications, that's a real cool idea.
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline
I started writing a script that does this using lua + linotify-git but then realized I do not know exactly how conky works. Do all you need to do is write a script that prints what you want to display and then it runs it and displays what you printed? What happens if the script returns more than one result per run (and runs constantly), as in each time the system is upgraded it would print a new last update time?
Last edited by Kiwi (2010-04-21 03:47:25)
Offline
I started writing a script that does this using lua + linotify-git but then realized I do not know exactly how conky works. Do all you need to do is write a script that prints what you want to display and then it runs it and displays what you printed?
What happens if the script returns more than one result per run (and runs constantly), as in each time the system is upgraded it would print a new last update time?
Yes, conky just outputs whatever the script prints. As for the second question, I'm not really sure, I've never tried that. I suspect conky would just stack all the prints on top of each other in its display.
Offline
I cannot get this stupid program (conky) to even print just "HI" without any fancy things from a Lua script. I have found there is Lua integration but A. it looks like a pain to use and B. it is disabled in Arch....
Anyone ever had luck with it?
Offline
I have had tremendous success with LUA in Conky on Arch. And all you need to to is put the text HI after the "TEXT" line. ^^;
Examples of my LUA usage:
http://fc02.deviantart.net/fs71/i/2010/ … usLink.png
http://kittykatt.silverirc.com/screens/conky-HUD.png
EDIT: Also, I've had success with getting the KDE version by doing the following...
kwin --version | awk '/^Qt/ {data="Qt v" $2};/^KDE/ {data=$2 " (" data ")"};END{print data}'
This is the method I'm currently using in screenFetch. Tested it a couple of times myself, but besides that, I'm not sure if it will work or not.
Last edited by kittykatt (2010-04-22 17:52:25)
- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -
Offline
It is Lua not LUA.
And I tried it again with an even simpler script and it showed the text...does it not print what comes from the script until the script returns?
Offline
My Desktop with Conky:
KDE version and Last sync and Last upgrades
http://danhorris.deviantart.com/art/MyA … -161628921
Thank you!
Offline
Looks nice, similar to one I use actually. could you post the code you used for grabbing your public ip?
Here's mine.
http://yfrog.com/j1desktopbqp
--empthollow
Check out my Arch based live distro http://fluxcapacity.99k.org
Offline
@empthollow, I use ${execi 3600 wget -O - http://ip.tupeux.com | tail}
Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.
Offline