[wellylug] bash script help

Mark Signal mark at remote-assist.co.nz
Thu Jan 27 13:29:39 NZDT 2005


I wrote this script  to check for and resend overly large emails that 
sometimes cause clamav to splat itself.

#!/bin/bash
if [ -f /var/spool/amavis-ng/problems/*.msg ]; then
        /usr/bin/amavis-inject /var/spool/amavis-ng/problems/*.msg | 
/usr/bin/rsmtp
        mv /var/spool/amavis-ng/problems/*.msg /root/duffemail
        mv /var/spool/amavis-ng/problems/*.log /root/duffemail
        echo "Problem email was re-sent - check you done got it" | mail 
-s "Problem email re-sent" tim at XXXX.co.nz
fi

 If works fine but if there are to many stuck email messages it  gives 
the following error:

./problememail.sh: [: too many arguments

presumably the  [ -f /var/spool/amavis-ng/problems/*.msg ] causes the 
problem ? Basically if the directory is not empty I want the script to run.

any suggestions appreciated

cheers


Mark  Signal


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.4 - Release Date: 25/01/2005




More information about the wellylug mailing list