Automating Software Updates with launchd

Discussion in 'Mac Programming' started by viggen9, Dec 20, 2007.

  1. viggen9 macrumors member

    Joined:
    Oct 18, 2004
    #1
    Hello. I'm trying to get launchd to act like cron and execute a script on Friday afternoons to install software updates (education environment). My shell script works fine, but I can't get launchd to launch it at a specific time.

    I am using:
    sudo launchctl load com.sps.autoupdate.plist which runs my script immediately instead of at the time specified within the plist. Any ideas as to how to correctly format the plist? Here it is:

    ?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
    http://www.apple.com/DTDs/PropertyList-1.0.dtd >
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.sps.autoupdate</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Users/test/SPSupdate</string>
    </array>
    <key>OnDemand</key>
    <false/>
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>16</integer>
    <key>Minute</key>
    <integer>00</integer>
    <key>Weekday</key>
    <integer>5</integer>
    </dict>
    </dict>
    </plist>

    Thanks for your help---
     
  2. CANEHDN macrumors 6502a

    CANEHDN

    Joined:
    Dec 12, 2005
    Location:
    Eagle Mountain, UT
    #2
    And why not just have Apple Updates update automatically?
     
  3. viggen9 thread starter macrumors member

    Joined:
    Oct 18, 2004
    #3
    Because this is for hundreds of Macs in an education environment.
     
  4. Krevnik macrumors 68040

    Krevnik

    Joined:
    Sep 8, 2003
    #4
    The big thing I see is that you don't actually specify a path to your script.

    <key>Program</key>
    <string>FULL_PATH_TO_APP</string>

    The script also needs to be set executable, owned by root, and have had group/everyone permissions for r/w stripped (launchd doesn't like launching jobs as root that can be writable by a normal user, as it is a security risk).
     
  5. tjwett macrumors 68000

    tjwett

    Joined:
    May 6, 2002
    Location:
    Brooklyn, NYC
    #5
    Deploying Updates...

    hey viggen9. i cannot help you with your script but i can tell you how i do it. i maintain about 300 Macs for a large newspaper and i've grown tired of trying to reliably automate the installations on the client machines. this is the method i've settled upon and it's been working great.

    we have an XServe running Software Update services and all of the clients are set via Workgroup Manager to use this for updates. so i have the server set to mirror all updates from Apple, but not enable automatically. when i want to deploy an important update i just enable it on the server. i have ARD running the Unix command "softwareupdate -i -a" as root on every machine on the network twice per day and i simply have each machine have a scheduled reboot every night after hours, via Workgroup Manager as well.
     
  6. aperkins macrumors newbie

    Joined:
    Jun 4, 2012
    #6
    ARD Still a great solution in 2012

    We were spinning our wheels trying to create client-side solutions as well. tjwett's solution using Apple Remote Desktop (ARD) works flawlessly. Maybe once we've gotten all the Windows updates, deployments, debugging, etc. completed we can try a client side solution again, but until then... :apple:
     

Share This Page