HOWTO: Display Available Updates in Conky

Share your own howto's etc. Not for support questions!

HOWTO: Display Available Updates in Conky

Postby plb » 2008-12-16 17:05

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.
plb
 
Posts: 472
Joined: 2007-04-22 14:24
Location: NYC

Postby Telemachus » 2008-12-16 19:39

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
User avatar
Telemachus
 
Posts: 4677
Joined: 2006-12-25 15:53

Postby plb » 2008-12-16 20:17

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.
plb
 
Posts: 472
Joined: 2007-04-22 14:24
Location: NYC

Postby oompa » 2008-12-18 14:34

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 ?
oompa
 
Posts: 25
Joined: 2008-11-14 15:39


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable