[softwaremgmt] [10.2]: Zypper and output redirection.
Hi there, for automatic updating on a number of clients I want to use zypper (0.6.15) activated by cron jobs but I run into a problem concerning the output of zypper. As I only want to be informed by cron if an update failed, I want to use something like 'X X * * * updatescript_wich_calls_zypper 1> /dev/null' as cronjob. Unfortunatelly that doesn't work as zypper gives his output in a way that i don't understand. Quite obviously stdout doesn't get used because a 'zypper up > /dev/null' still renders output in the shell. Can anybody push me into the right direction: How can I catch zyppers output and filter good from bad? TIA Cheerz Lars -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
As I only want to be informed by cron if an update failed, I want to use something like
'X X * * * updatescript_wich_calls_zypper 1> /dev/null'
as cronjob. Unfortunatelly that doesn't work as zypper gives his output in a way that i don't understand.
Quite obviously stdout doesn't get used because a 'zypper up > /dev/null' still renders output in the shell.
On Mon, 13 Aug 2007, Lars Behrens wrote: try zypper up 2> /dev/null the 2 is for standard error instead of standard output. Did you use exit codes, too? I'm interested in the script, since the one you get from yast - automatic update is a) creating mails for nothing b) not doing a SuSEconfig best regards, Andreas -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
Am Monday 13 August 2007 18:00 schrieben Sie:
try zypper up 2> /dev/null the 2 is for standard error instead of standard output.
Normally that would be the opposite of what I want, as it would kill the error messages, which I want to receive from cron. But after a bit of tinkering, it seems to me that zypper uses stderr for both stderr *and* stdout. So I have to find a different way to inform me about failed upgrades.
Did you use exit codes, too?
No, but it seems that I have to :-)
I'm interested in the script,
I can post it when it's ready.
since the one you get from yast - automatic update is a) creating mails for nothing
Like zypper? :-)
b) not doing a SuSEconfig
Hmm, never thought of that. Does zypper? Is there a logfile for SuSEconfig? Maybe I should call SuSEconfig from the script... Cheerz Lars -- Universität Karlsruhe (TH) Physikalisches Institut 0721/608-3448 lars.behrens@physik-uni-karlsruhe.de -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
* Lars Behrens <lars.behrens@pi.uka.de> [Aug 14. 2007 13:51]:
Am Monday 13 August 2007 18:00 schrieben Sie:
try zypper up 2> /dev/null the 2 is for standard error instead of standard output.
Normally that would be the opposite of what I want, as it would kill the error messages, which I want to receive from cron. But after a bit of tinkering, it seems to me that zypper uses stderr for both stderr *and* stdout.
Would you mind to file an enhancement/minor bug report on this ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
Am Tuesday 14 August 2007 13:55 schrieb Klaus Kaempf:
Would you mind to file an enhancement/minor bug report on this ?
[x] done Cheerz Lars -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
Hello, on Dienstag, 14. August 2007, Lars Behrens wrote:
Am Monday 13 August 2007 18:00 schrieben Sie:
try zypper up 2> /dev/null the 2 is for standard error instead of standard output.
Normally that would be the opposite of what I want, as it would kill the error messages, which I want to receive from cron. But after a bit of tinkering, it seems to me that zypper uses stderr for both stderr *and* stdout.
So I have to find a different way to inform me about failed upgrades.
Proof of concept: output="`zypper up 2>&1`" || { echo "$output" | mail -s "update failed" root@localhost }
Did you use exit codes, too?
No, but it seems that I have to :-)
See above ;-) BTW: For those who are interested in mailed update notifications (without unstalling the patches), patch2mail in my home:cboltz buildservice repo might be useful. Regards, Christian Boltz --
Ohh jee ... ich will mein yast1 wieder *heul* :-)) Ich hab's noch, ich hab's noch... *freu* *hüpf* *SuSE 7.3 behalt* Bleib mir weg mit deiner neumodischen 7.sonstwas! [>> Konrad Neitzel, > Florian Gross und David Haller in suse-linux] -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
Am Tuesday 14 August 2007 14:50 schrieb Christian Boltz:
the error messages, which I want to receive from cron. But after a bit of tinkering, it seems to me that zypper uses stderr for both stderr *and* stdout.
So I have to find a different way to inform me about failed upgrades.
Proof of concept:
output="`zypper up 2>&1`" || { echo "$output" | mail -s "update failed" root@localhost }
Yepp, somthing like that. But that doesn't seem to be very safe either, eg. zypper exits with 0 even when I run it as user (according to man page it should exit with 5). Cheerz Lars -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
Dňa Tuesday 14 August 2007 15:30:07 Lars Behrens ste napísal:
Am Tuesday 14 August 2007 14:50 schrieb Christian Boltz:
the error messages, which I want to receive from cron. But after a bit of tinkering, it seems to me that zypper uses stderr for both stderr *and* stdout.
So I have to find a different way to inform me about failed upgrades.
Proof of concept:
output="`zypper up 2>&1`" || { echo "$output" | mail -s "update failed" root@localhost }
Yepp, somthing like that. But that doesn't seem to be very safe either, eg. zypper exits with 0 even when I run it as user (according to man page it should exit with 5).
Please, file a bug report. Stano -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
Am Tuesday 14 August 2007 15:36 schrieb Stanislav Visnovsky:
eg. zypper exits with 0 even when I run it as user (according to man page it should exit with 5).
Please, file a bug report.
[x] done Cheerz Lars -- To unsubscribe, e-mail: opensuse-softwaremgmt+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-softwaremgmt+help@opensuse.org
participants (5)
-
Andreas Vetter
-
Christian Boltz
-
Klaus Kaempf
-
Lars Behrens
-
Stanislav Visnovsky