Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Ubuntu,  Unix

Automatic Script Updates

Yesterday I posted about Randomizing the Software Update Server for Mac OS X. I posted the script, which I called randomsus.sh at https://krypted.com//Scripts/randomsus.sh. But, what if you wanted to update the Software Update Server list in the script automatically using your own URL (ie – on a timed interval)? In this case, you could simply use the following script, which pulls a new copy of the randomsus.sh script from the site:

#!/bin/bash
URL=”https://krypted.com//Scripts/randomsus.sh”
PATH=”/Scripts/randomsus.sh”
/usr/bin/curl $URL > $PATH
exit 0

Notice that I made the URL and PATH variables. This is really just to make it easier to use if others choose to do so. It would also be pretty easy to add a line at the end to run the randomsus.sh script; therefore, it would download the latest copy of the script and then run it. This can also be used as a vehicle for running a number of scripts, pushing out timed updates without ARD (or another similar software package) or just setting a nightly event to look for changes to something and then run it, a process we’ll call mutex checking, for future reference.