You are not logged in.
Pages: 1
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
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
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
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
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
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
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
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
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
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
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...
Offline
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
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
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
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
Offline
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.
Offline
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
Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.
Offline
I have found a worked code
Offline
Pages: 1