So I decided I would share. 🙂 This is the cron job I use to keep OS X machines up to date with LiveUpdate and Norton AntiVirus 9.0.1. It’s a fairly simple script. I put this in /sw/etc/cron.daily/ because I use anacron that I installed with Fink. If you don’t want Fink on your system then there is a system cron that is in /etc you can use, but it requires that the machine must be on when the cron job should run. This condition was not acceptable to me. Read on to see the script…

The first line of the script is like any other shell script “#!/bin/sh” to tell it to run it with that shell. Hope you all like. Make sure you catch the line breaks below. If you have troubles just post here. Be sure to change the 2 instances of “yourdomain.com” with your company’s domain / server or just use symantec, and change the Service Desk phone number from 222 222-2222 to your own.

#!/bin/sh

################
#
# Joshies Nav Updater
# 2004020601
#
#################

# echo "Testing age of liveupdt.log file..."
count=`find "/Library/Application Support/Norton Solutions Support/LiveUpdate/" -name liveupdt.log -a -mtime -7 -print | wc -l` > /dev/null
if [ $count -eq 1 ]
then
# echo "The file is under 30 days... ending check..."
exit 0
#else
# echo "The file is not so new. Moving on..."
fi

# echo "Testing for connection..."
while true ; do
(
dig liveupdate.yourdomain.com IN A &
DIG_PID=$!
{ sleep 2 ; kill $DIG_PID ; } &
wait $DIG_PID
) 2>/dev/null | grep -q '^[^;]*yourdomain.com' && break
done

# echo "Connection found..."
if [ -f "/Applications/Norton Solutions/LiveUpdate.app/Contents/MacOS/Liveupdate" ]
then
"/Applications/Norton Solutions/LiveUpdate.app/Contents/MacOS/LiveUpdate" -liveupdateautoquit YES -update LUal
else
osascript -e 'tell app "Finder" to activate' -e 'tell app "Finder" to display dialog "ALERT: Please contact the Service Desk at (222) 222-2222. Your AntiVirus software needs repair. LiveUpdate could not be found in the expected location."'
fi
exit 0

 

Advertisements