RE: [SLE] Updating antivir via cron results in failure
Thanks, Carlos. I checked into the README as suggested the other day, and it looks like the answer to this is indeed right there. My antivir_update script works OK, but does not include any checking for the return code. The README has an example of what I should be using, but I'd like confirmation of the logic. The example is: #!/bin/sh /usr/lib/AntiVir/antivir --update -q case $? in 0) echo "AntiVir is up-to-date" ;; 1) echo "AntiVir has updated itself" ;; *) echo "AntiVir had an error trying to update" ;; esac To me, this seems to do the following: 1. antivir --update tries to do the update 2. when the update is done, case receives the return code from the update process 3. if the return code is 0 or 1, all was well, anything else is bad 4. because the case statement will always get a hit (because of the wildcard), it will always return a 0 (TRUE ?) back to cron, thereby making sure cron thinks the job ran OK. #4 is what I'm a bit fuzzy on. It's 10 years now since I did any programming, so my assumptions may be wrong. Is my interpretation of this script correct ? Bye for now, Stuart. -----Original Message----- From: Carlos E. R. [mailto:robin1.listas@tiscali.es] Sent: Wednesday, October 06, 2004 3:47 PM To: SuSE Linux English Subject: Re: [SLE] Updating antivir via cron results in failure The 2004-10-06 at 12:20 -0400, Powell, Stuart wrote:
SCRIPT: antivir_update exited with RETURNCODE = 1. SCRIPT: ouput (stdout && stderr) follows
When a cron job returns with something not zero, it assumes some failure and emails you the output tex, so that you decide what to do. The script antivir_update is the culprit, it is not returning a zero value. Change that. -- Cheers, Carlos Robinson -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
The Friday 2004-10-08 at 10:55 -0400, Powell, Stuart wrote: Mmm. Your mail program has a problem: it is not keeping threading information, and thus, your post doesn't appear to be an answer to my previous post. I almost did not see it.
I checked into the README as suggested the other day, and it looks like the answer to this is indeed right there. My antivir_update script works OK, but does not include any checking for the return code. The README has an example of what I should be using, but I'd like confirmation of the logic.
I think it is correct. Perhaps you want to change a litle thing so that it outputs 1 when there was a problem: ;; *) echo "AntiVir had an error trying to update" exit 1 ;; esac
4. because the case statement will always get a hit (because of the wildcard), it will always return a 0 (TRUE ?) back to cron, thereby making sure cron thinks the job ran OK.
Correct. Or, as sugested above, you can make it return 1 when there was an error, so that you make sure to receive at least an email if it crashes.
#4 is what I'm a bit fuzzy on. It's 10 years now since I did any programming, so my assumptions may be wrong. Is my interpretation of this script correct ?
I think so... but I'm not a bash scripting expert. I do program now and then, but little things, not for a living anymore. And bash is fairly recent to me. -- Cheers, Carlos Robinson
participants (2)
-
Carlos E. R.
-
Powell, Stuart