Solved

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

Posted on 2010-09-23
5
606 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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