[SunHELP] cron script error

Cardinal Christopher sunhelp at sunhelp.org
Wed Feb 28 12:50:31 CST 2001


When I run a script from the command line as root, it works fine. When I run
the script as a cron job for root, I get an error (I think I am missing
something simple here.) The script and error are below:

ERRORS:
/usr/netscape/smartfilter/get_lists[41]: -O:  not found
/usr/netscape/smartfilter/get_lists[42]: -O:  not found

SCRIPT: I made bold the errors in the script when run from cron
#!/usr/bin/ksh
# SmartFilter Download Script
# Generated by installation program

FTP_PROXY="http://gateway"
SMART="/usr/netscape/smartfilter"
LOG="$SMART/smart.log"
WGET="$(whence wget)"
DATE=`date`
MAIL=/usr/ucb/mail
cd $SMART
echo "$DATE" > $SMART/smart.log

#SmartFilter Download Script

if [ -f "wtcontrol.new" ];then
  rm wtcontrol.new
fi

if [ -f "wtcntldr.new" ];then

if [ -f "wtcntldr.new" ];then
  rm wtcntldr.new
fi

## Following FTP script replaced by wget...
#echo "Running ftp.."
# Change "user" command below to specify a different account
# and password, in the format "user [account] [password]"
#echo "open 
#user s
#cd /pub/NetscapeProxy/SOLARIS2
#bin
#get wtcontrol wtcontrol.new
#get wtcntldr wtcntldr.new
#close
#quit
#" | ftp -n

$WGET -O $SMART/wtcontrol.new -o $LOG -nH ftp://test:test@ftp.smartfilter
.com/pub/NetscapeProxy/SOLARIS2/wtcontrol
$WGET -O $SMART/wtcntldr.new -a $LOG -nH ftp://test:test@ftp.smartfilter.
com/pub/NetscapeProxy/SOLARIS2/wtcntldr

if [ ! -f "wtcontrol.new" ];then
        echo "Error: failed to download wtcontrol file, aborting..."
        $MAIL -s"Smart Download-1 failed" test at test.test.com
        exit 1
fi

if [ ! -f "wtcntldr.new" ];then
        echo "Error: failed to download wtcntldr file, aborting..."
        $MAIL -s"Smart Download-2 failed" test at test.test.com
        exit 1
fi

echo "Checking control lists.."

r1=`./sfctlchk wtcontrol.new`
r2=`./sfctlchk wtcntldr.new`

if [ ! $r1 = "OK" ];then
 echo "Error: wtcontrol file appears to be corrupt"
        $MAIL -s"Smart Download-3 failed" test at test.test.com
fi

if [ ! $r2 = "OK" ];then
        echo "Error: wtcntldr file appears to be corrupt"
        $MAIL -s"Smart Download-4 failed" test at test.test.com
fi

if [ $r1 = "OK" -a $r2 = "OK" ];then
    echo "Installing new control lists, saving old lists as *.previous.."
    mv wtcontrol wtcontrol.previous
    mv wtcontrol.new wtcontrol
    mv wtcntldr wtcntldr.previous
    mv wtcntldr.new wtcntldr
    echo "Setting permissions.."
    chmod a+r wtcontrol
    chmod a+r wtcntldr
else
        echo "Corrupt list(s), aborting..."
        $MAIL -s"Smart Download-5 failed" test at test.test.com
        exit
fi
echo "SmartFilter lists successfully downloaded."
$MAIL -s"Smart Download succeeded" test at test.test.com
exit
# End of generated script

Any ideas?

Thanks,
C



More information about the SunHELP mailing list