Solved

Using applescript to run "softwareupdate -ia" and the reboot.. anyone? :D

Posted on 2010-09-23
5
608 Views
Last Modified: 2012-05-10
Hi.

Does anyone have a applescript that wil run softwareupdate -ia and the reboot the mac?


0
Comment
Question by:ErikVest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 33742840
Seems like this article contains the full answer:
Apple Software Update options
http://managingosx.wordpress.com/2009/10/12/apple-software-update-options/
0
 

Author Comment

by:ErikVest
ID: 33743167
Hi.

Well, it's embarrassing to write this but right after i was finish writing this question i found out the following command: softwareupdate -i -a;reboot. That solved it. But the page was good so i give yoy credit for that.


Best regards
 

 
0
 

Author Closing Comment

by:ErikVest
ID: 33743186
Se the comment above.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33743274
yes. But it's bash. I think you need 'sudo'.
I thought you are looking for Applescript. I didn't want to make a wrapper for these two commands on my Mac now, it was not a good time to reset my computer, so I posted the link. :)
You are welcome.
0
 

Author Comment

by:ErikVest
ID: 33743869
he he.. well it has to do with what i'm actually thinking about and what i manage to write down.. those two things is sometime not the same.. :D

But for further records i can post the applescript here:

tell application "Remote Desktop"
      set theScript to "softwareupdate -i -a; reboot" --build the command for
the Unix task
      set theTask to make new send unix command task with properties {showing
output:true, user:"root", script:theScript} --build the task

      set theClients to the selection
      if (length of theClients) = 0 then --no sense in whining, and with the
way Apple Remote Desktop works, I'm not sure this condition is possible,
so an empty selection fails silently
      else if (length of theClients) = 1 then
            try
                  display dialog "By default, ARD always selects the topmost computer in
a list. If this is the computer you want to upgrade, click the
\"Okay\" button"
                  --This is a warning I put in, because ARD *always* selects the first
client in a computer list, so while that avoids
                  --a problem with an empty selection, it can create a problem if you
don't notice that the wrong computer is selected
                  --i only ask this if a single computer is selected

                  set theTaskResult to execute theTask on theClients --run the task, save
the results

            end try
      else if (length of theClients) > 1 then
            set theTaskResult to execute theTask on theClients --run the task, save
the results
            --I use an else if, because I don't want any default that would run the
task outside of the specific desired situation
      end if
end tell

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface   In the first 100 days of the Macintosh release in January 1984, Apple sold 72,000 of the computers. Relatively cheap, easy-to-use personal computer with a graphical operating system. I've never seen this model. I did see this one:   …
CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question