You are not logged in.

#1 2014-08-05 10:22:12

satshow
Member
Registered: 2014-08-05
Posts: 7

[Solved] Show updates in conky

Hi,

I use this code for show system updates in the conky but it don't work

${color #1CA9EE}Systeem Updates: ${color5}${alignr}${execi 3600 aptitude search "~U" | wc -l | tail} ${color7}Pakketten

What is the correct 1 for show updates in conky?

Last edited by satshow (2014-08-05 19:54:17)

Offline

#2 2014-08-05 10:27:46

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,163
Website

Re: [Solved] Show updates in conky

Updates? You mean package updates?

This isn't Ubuntu, so calling aptitude doesn't work...

There is the following command you can use for checking if there are any updates

checkupdates

Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#3 2014-08-05 10:32:31

satshow
Member
Registered: 2014-08-05
Posts: 7

Re: [Solved] Show updates in conky

Thank you. I know it's from ubuntu but I don't use this anymore.

I have change the code. Does this work?

[${color #1CA9EE}Systeem Updates: ${color5}${alignr}${checkupdates} ${color7}Pakketten

Offline

#4 2014-08-05 10:45:41

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: [Solved] Show updates in conky

no (besides, you could've just tested it yourself), checkupdates is not a conky object, but a shell command.
try running it, and it should list all package updates.
to use it with conky you need to use conky's exec, just like you would with aptitude.
If you want the number of package updates, instead of literal list of all updates, you should pipe the output to 'wc -l' just like on that aptitude example

so, something like this in your .conkyrc should work:

${execi 3600 checkupdates | wc -l}

Last edited by ooo (2014-08-05 10:46:42)

Offline

#5 2014-08-05 11:07:12

satshow
Member
Registered: 2014-08-05
Posts: 7

Re: [Solved] Show updates in conky

Thank you. I don't have any updates right now I see.
I have change the code and wait for updates and see if it works perfect.

Offline

#6 2014-08-05 14:37:48

hilltownboy
Member
From: Massachusetts
Registered: 2013-08-15
Posts: 100

Re: [Solved] Show updates in conky

The following entry at the end of /etc/conky/conky.conf does it for me:

Last Upgraded: ${execi 60 grep 'upgraded' /var/log/pacman.log | tail -1 | awk  '{print$1}'} ${alignr}

A similar entry using acpi -b makes conky show battery condition.

Offline

#7 2014-08-05 14:51:02

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

Re: [Solved] Show updates in conky

hilltownboy, that just show when the last upgraded was, it doesn't say anything about when updates are available.

But the main reason I wanted to reply is that seeing a grep-tail-awk pipeline made me cringe.

The following single command does the same thing (though in both of these you'd probably want to get rid of the open bracket too):

awk '/upgraded/ { when=$1;} END { print when; }' /var/log/pacman.log

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2014-08-05 15:01:17

hilltownboy
Member
From: Massachusetts
Registered: 2013-08-15
Posts: 100

Re: [Solved] Show updates in conky

Thanks, Trilby.  Your comments are helpful, and as an untrained linux do-it-yourselfer I appreciate them.  I had never used awk before.
What is the "open bracket".

Last edited by hilltownboy (2014-08-05 15:09:09)

Offline

#9 2014-08-05 15:13:32

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

Re: [Solved] Show updates in conky

Your command returns the following:
[2014-08-05
When I suspect one would want just:
2014-08-05


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2014-08-05 16:25:51

satshow
Member
Registered: 2014-08-05
Posts: 7

Re: [Solved] Show updates in conky

Thanks for the code. I have put these in my conky. This is my code now, I hope these is correct

${color #1CA9EE}Systeem Updates: ${color5}${alignr}${execi 60 grep awk '/upgraded/ { when=$1;} END { print when; }' /var/log/pacman.log | wc -l | tail} ${color7}Pakketten

Offline

#11 2014-08-05 18:02:20

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Show updates in conky

Not sure where you got that odd awk line, but it is (assuming it works) going to show you packages you recently updated, not pending updates...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#12 2014-08-05 18:16:12

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

Re: [Solved] Show updates in conky

That line was my correction to hilltownboy's suggestion.  It doesn't seem to do anything useful - but my OCD couldn't allow a bad use of awk to be left alone wink


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2014-08-05 18:21:01

satshow
Member
Registered: 2014-08-05
Posts: 7

Re: [Solved] Show updates in conky

Here is the last code of my conky
What is the correct code to show updates?

${color #4AEDC5}Systeem:
${color #1CA9EE}Hostnaam: ${color }$alignr $nodename
${color #1CA9EE}Distributie: ${color }$alignr ${pre_exec cat /etc/issue.net} $machine 
${color #1CA9EE}Kernel: ${color }$alignr $kernel
${color #1CA9EE}Public IP:${color5}${alignr} ${execi 300 wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}
${color #1CA9EE}Local IP:${color5}${alignr}${addr enp3s0}
${color #1CA9EE}Router IP:${color5}${alignr}${gw_ip}
${color #1CA9EE}DNS: ${color5}${alignr}$nameserver
${color #1CA9EE}Systeem Updates: ${color5}${alignr}${execi 60 grep awk '/upgraded/ { when=$1;} END { print when; }' /var/log/pacman.log | wc -l | tail} ${color7}Pakketten

Offline

#14 2014-08-05 18:21:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Show updates in conky

Trilby wrote:

That line was my correction to hilltownboy's suggestion.  It doesn't seem to do anything useful - but my OCD couldn't allow a bad use of awk to be left alone wink

smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#15 2014-08-05 18:24:10

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Show updates in conky

satshow wrote:

What is the correct code to show updates?

The correct way to show updates is to use `checkupdates`. If you are unsure how to use the command, use the `-h` option and read the script (it is well commented).
You should also look through the conky thread: it probably contains working examples.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#16 2014-08-05 18:27:05

satshow
Member
Registered: 2014-08-05
Posts: 7

Re: [Solved] Show updates in conky

I am go look to the conky tread

At the moment I use this code

${color #1CA9EE}Systeem Updates: ${color5}${alignr}${execi 3600 checkupdates | wc -l} ${color7}Pakketten

Offline

#17 2014-08-05 19:05:51

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Show updates in conky

Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#18 2014-08-05 19:53:42

satshow
Member
Registered: 2014-08-05
Posts: 7

Re: [Solved] Show updates in conky

I have found a worked code

Offline

Board footer

Powered by FluxBB