Suggested change to script

Mark Sapiro mark at
Tue Sep 8 16:14:34 IST 2009

Julian Field wrote!
>I basically like it. You've got 2 small problems
>1) The "if [ reload ==1 ]; then" line should of course read "if [ 
>"$reload" = "1" ]; then"
>(i.e. you mean "=" for comparing strings (though == does appear to work, 
>it's not documented in test(1)), and you missed the "$" off the front of 
>$reload which is rather more critical! :-)

Ouch! Obviously a case of sloppy coding plus inadequate testing (only
testing the case where it was intended not to reload.

>2) What happens if the downloaded file is bad and you haven't already 
>got a backup of it?
>I have solved that one by deleting the downloaded file in that case.

Again, this is clearly more robust than mine, but what about the case
where wget fails and there is no backup? Consider

@@ -51,7 +51,14 @@
   echo It failed to complete properly
-  cp -f
+  if [ -r ]; then
+    cp -f
+  else
+    # No backup file present, so delete file if any
+    echo ERROR: wget of failed and no backup
+    rm -f
+    reload=0
+  fi

 # Reload MailScanner only if we need to.

(patched file attached)

Mark Sapiro <mark at>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/x-zip-compressed
Size: 914 bytes
Desc: not available
Url :

More information about the MailScanner mailing list