Re: Script to check for updates
- From: "Teo" <matteo.corti@xxxxxxxxx>
- Date: 23 Feb 2007 09:39:51 -0800
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
.
- Follow-Ups:
- Re: Script to check for updates
- From: noi
- Re: Script to check for updates
- References:
- Script to check for updates
- From: Teo
- Re: Script to check for updates
- From: noi
- Script to check for updates
- Prev by Date: Re: Script to check for updates
- Next by Date: Re: How to forward all mail to relay?
- Previous by thread: Re: Script to check for updates
- Next by thread: Re: Script to check for updates
- Index(es):
Relevant Pages
|
|