Solved

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

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to factory unlock iphone 4s 7 634
get value from nsdictionary from a variable 5 2,006
UITabBar color 3 189
Minimum requirements to develop Apple App 8 24
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

831 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