Search
Enter Keywords:
Home
Automating NAV and Software Update using cron on OS X PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Michael Salsbury   
Friday, 03 June 2005

Part of setting up our Mac OS X environment was ensuring that our antivirus software was kept up to date.  After extensive testing and research, I learned that Norton AntiVirus 8.0 would not automatically update unless the current user was an administrator and logged in at the time of update.  That wasn't going to work in our environment, so I needed to find a way to automate this.  Eventually, Symantec supplied me with the following command line:

00 23 * * * /Applications/Norton\ Solutions/LiveUpdate.app/Contents/MacOS/LiveUpdate -update LUal -liveupdateautoquit YES -liveupdatequiet YES

This tells Norton to run its LiveUpdate function and "quietly" (i.e., with no user intervention) update itself.  The numbers and  asterisks at the start of that line are cron syntax that tell the Mac to do this every day at 11pm.

I also wanted Norton AntiVirus to scan for viruses and log the results in a file in my  /Library/Admin folder.  Here's how to do that via cron:

15 23 * * * /usr/bin/navx -c -f -h -Q -o /Library/Admin/scanresults.txt /Volumes/*
The scan will be done and the output made available in the file "/Library/Admin/scanresults.txt"

The last thing I wanted to be able to do was perform automatic updates of OS X without manual intervention.  This cron task does that:

00 04 * * * /usr/sbin/softwareupdate -q -i -r

But I have to warn you that there's a problem with this.  Apple likes to think that QuickTime updates are "required" updates.  As defined above, Software Update will overwrite your QuickTime Pro installation over with a newer version whenever one comes out.  If you don't want that to happen, I recommend NOT using this particular cron.

If you've never used cron on OS X before, it's actually pretty easy.  To use any or all of the above crons, just create a new text file in TextEdit and paste the line(s) into it.  Save the file as a plain text file.  Login as admin or root, then launch a Terminal window. At the command line, enter:

crontab <filename>

Where "<filename>" is the path and file name of the file you saved earlier with the crons in it.  For example, if you saved them in "stdcrons.txt" in your "/Library/Admin" directory, you'd type:

crontab /Library/Admin/stdcrons.txt

To verify that OS X "got it" and plans to run those crons for you, type the following:

crontab -l

It should show you a list of the crons it's going to run for you.

As with all my tips and information, use at your own risk. I'm not responsible for any damage or problems you may encounter as a result of using this information.  You agree to assume that risk and liability when you attempt to use the information provided.+