Automatically download software update over a specific network I want my mac to automatically download updates for me only if I am connected to a specific WiFi network. Is this possible with a script? If so, how?
here is a working script, you just need customise it by changing the target_network value, which is the network you wish it to Enable AutoUpdates. And for all other wifi networks it will disable updates.

#/bin/bash

# Get WiFi network name
wifi_network=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | grep '\sSSID:' | sed 's/.*: //'`

# Set the name of the target network where you
# want it to ENABLE Automatic Downloads
#
target_network='MyHome_Network'


echo "Currently Connected to: $wifi_network wifi network"


if [ "$wifi_network" == "$target_network" ] ;
        then `sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool TRUE`
        echo "Download updates ENABLED";
else
        `sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool FALSE`
        echo "Download updates DISABLED";
fi



You have to put it to run on cron as root, or create a launchctl system service daemon (it is just a .plist XML file) to schedule it to run at some time interval.



For testing, you can read the current system updating settings with this command:
sudo defaults read /Library/Preferences/com.apple.SoftwareUpdate 

Run the script, read the settings, you will see it changes.



Complement:

here is a good tutorial to create a launchd daemon [with a XML example file included on the tutorial] to run a bash script as job in time intervals, I am adding it here because it fits perfectly as a complement to my answer, and will explain step by step how you can put the script above that I created, as a launchd daemon.

https://alvinalexander.com/mac-os-x/mac-osx-startup-crontab-launchd-jobs