HOWTO: Display Available Updates in Conky

Share your own howto's etc. Not for support questions!
Post Reply
Message
Author
plb
Posts: 472
Joined: 2007-04-22 14:24
Location: NYC

HOWTO: Display Available Updates in Conky

#1 Post by plb »

I've written a small script for us Debian users which displays the number of available updates within conky. This script assumes you are in the sudo group and can gain root access without a password. Simply save this code as debupdates.sh in your ~/bin or wherever you like and make it executable. Here is the code:
#!/bin/bash
# Conky script for displaying available updates
# in Debian. This script assumes you are in the
# sudo group and require no password for root
# access. Add something as such to your conkyrc:
#${color}APT: ${color D7D3C5}${execi 28800 ~/bin/debupdates.sh}

sudo apt-get -qy update > /dev/null
NUMOFUPDATES=$(aptitude search "~U" | wc -l)
echo $NUMOFUPDATES Updates Available
Next, you simply add something like this to your conkyrc file which will check for updates every 8 hours.
$color}APT: ${color D7D3C5}${execi 28800 ~/bin/debupdates.sh}
Here is a screenshot of what it looks like:

Image
Last edited by plb on 2008-12-16 20:18, edited 1 time in total.

User avatar
Telemachus
Posts: 4677
Joined: 2006-12-25 15:53

#2 Post by Telemachus »

You don't need root privileges to search via aptitude. So the second bit could simply use aptitude search "~U".
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

plb
Posts: 472
Joined: 2007-04-22 14:24
Location: NYC

#3 Post by plb »

Telemachus wrote:You don't need root privileges to search via aptitude. So the second bit could simply use aptitude search "~U".
Ah thanks..didn't know...the first part does however require it. I've fixed the 2nd bit though.

oompa
Posts: 25
Joined: 2008-11-14 15:39

#4 Post by oompa »

I'm not a fan of sudo, and having to sudo without password for a conky script to work seems unsecure at least, may I suggest moving the aptitude update part of the script to cron ?

Post Reply