Re: Script to check for updates



Hi noi,

On Feb 23, 6:17 pm, noi <n...@xxxxxxxx> wrote:
On Fri, 23 Feb 2007 08:17:54 -0800, Teo wrote this:
On Fedora I check using "yum check-updates" which kindly exits with a
return value of 100 if updates are available or 0 otherwise.
[...]

I'm confused are you not printing the yum check-updates output?
Can't you write the output to a file and mail the file to yourself?

yum check-updates > updates.txt && mail -s "updates" -a updates.txt
teo@localhost

Yes I could but I just need a yes/no answer inside a perl script. With
yum I can do the following:

my $ret = system('yum check-update > /dev/null 2>&1 ') >> 8;

if($ret == 100) {
# updated are needed
} else {
# no updates are needed
}

I do not need to see the actual output and I can check even as a non-
root user.

I would like to do something similar with up2date. At the moment I
came up with:

my $updates = `up2date -l | grep -A 64 --
'--------------------------' | grep [a-z] | wc -l `;
if ($updates > 0) {
# updated are needed
} else {
# no updates are needed
}

This is less clean but it works. The problem is that it can only be
executed by root.
If I execute up2date as a normal user I get no output (or the password
prompt if the session is interactive).

Thanks,

Matteo

.



Relevant Pages

  • Re: Windows / Microsoft Update
    ... > When searching for available updates on the Update site, ... > Alan wrote: ... >> session from datastore, error = 0x80004002 ...
    (microsoft.public.windowsupdate)
  • Re: Win2K Task Scheduler says running but its not
    ... > through scheduled maintence cycles where updates are applied. ... if you search for schedule and/or ... while logged in with different account. ... session with different SessionID than that of my then current TS session, ...
    (microsoft.public.win2000.security)
  • Re: Windows / Microsoft Update
    ... When searching for available updates on the Update site, ... session from datastore, error = 0x80004002 ...
    (microsoft.public.windowsupdate)
  • Re: An error appears
    ... OS - XP Pro - No Connections to the Internet - no updates done. ... Session = Admin ... Christophe Mathon wrote: ... What kind of session do you have? ...
    (microsoft.public.scripting.vbscript)
  • Re: run advertised programs within terminal session
    ... Software Updates functions are only available in session 0, ... not work in terminal server sessions. ...
    (microsoft.public.sms.swdist)