Listing 1

#!/usr/bin/ksh

CURL=/usr/global/pkgs/curl-7.14.0/bin/curl
DLDIR=/nim/suma/invscout
DATEEXT=`date +%m%d%Y`     # Format: MMDDYYYY
FILEBASE=catalog.mic

URL=https://techsupport.services.ibm.com/server/mdownload/catalog.mic

OLDFILE=`/usr/bin/ls -1tr $DLDIR/$FILEBASE* | tail -1`

$CURL -s -o $DLDIR/$FILEBASE.$DATEEXT $URL
diff $DLDIR/$FILEBASE.$DATEEXT $OLDFILE > /dev/null
if [ $? -eq 0 ]; then
    # This file is the same, stick with the old one
    rm $DLDIR/$FILEBASE.$DATEEXT
else
    # This file is new, copy to the shared location for invscout
    cp $DLDIR/$FILEBASE.$DATEEXT /usr/global/invscout/$FILEBASE
fi

find $DLDIR -mtime +180 -exec rm {} \;


