I use Mac OS X laptops as my primary development platforms.
With that I have set up Time Machine to backup the numerous Macs floating around the office. Most are used as "remotes" from my main development machine and as such its okay to have Carbonite and Time Machine sucking down a huge amount of cycles (which they do).
For example, running two or more of Logic, PhotoShop, Illustrator, Parallels, XCode, etc. usually bog things down to the point of uselessness.
Carbonite usually hums along at about 60% in the background heating up the laptop significantly as well.
So what can you do to fix this?
Of course you can manually diddle with the apps turning them on and off but of course you'll forget at some critical point to turn them back on and poof - two days of work lost!
For me I would like the backups to run at night - say between about 8 PM and 7 AM when I am not using the computer for development. This keeps the worst of it out of my way.
Fortunately there are some relatively simple solutions.
First, in the case of Time Machine you need to create two AppleScripts:
T_M-On.scpt
do shell script "defaults write /Library/Preferences/com.apple.TimeMachine AutoBackup -bool true"
T_M-Off.scpt
do shell script "defaults write /Library/Preferences/com.apple.TimeMachine AutoBackup -bool false"
Next you need to use iCal to set up a daily event starting when you would like backups to begin and ending when you would like them to finish.
Associate the T_M-On.scpt with the start of the event, e.g., 8 PM and T_M-Off.scpt with the end of the event.
So in this example we have set it up to run the Time Machine "Enable" at the start of the event and the "Disable" at the end (in this case 7 AM or so).
I set this to repeat each day.
In the case of Carbonite, which is not built into Mac OS X like Time Machine, you need an AppleScript to access the "System Preferences" and perform the same type of function. Carbonite's control panel is somewhat non-AppleScript friendly so you have to do something like this:
Carbonite-Enabled-Script.scpt:
tell application "System Preferences"
activate
set the current pane to pane id "com.carbonite.prefpanel"
tell application "System Events"
tell process "System Preferences"
-- Carbonite Version 1.1.11 build 582
--
-- Select the "Status" Window
--
click radio button "Status" of tab group 1 of window 1
-- Click the "Backup is: Enabled/Paused pop up
-- to bring up the choice list...
click pop up button 1 of tab group 1 of window 1
-- The choices are Enabled, Paused, in Recover Mode, Disabled.
--
-- So we use the "up arrow" to move to the top of the
-- choice list "Enabled" - we use three "up arrows" because
-- this ensures we get to the top
--
-- Choices are:
-- keystroke (ASCII character 30) -- up arrow key
-- keystroke (ASCII character 31) -- down arrow key
-- keystroke (ASCII character 29) -- right arrow key
-- keystroke (ASCII character 28) -- up arrow key
keystroke (ASCII character 30)
keystroke (ASCII character 30)
keystroke (ASCII character 30)
-- Enter a "return"
key code 36
-- Leave the window open so we can see the state…
--
end tell
end tell
end tell
Unfortunately the version will change and this will break but at least for now this seems to work.
Carbonite-Diabled-Script.scpt:
tell application "System Preferences"
activate
set the current pane to pane id "com.carbonite.prefpanel"
tell application "System Events"
tell process "System Preferences"
-- Carbonite Version 1.1.11 build 582
--
-- Select the "Status" Window
--
click radio button "Status" of tab group 1 of window 1
-- Click the "Backup is: Enabled/Paused pop up
-- to bring up the choice list...
click pop up button 1 of tab group 1 of window 1
-- The choices are Enabled, Paused, in Recover Mode, Disabled.
--
-- So we use the "up arrow" to move to the top of the
-- choice list "Enabled" - we use three "up arrows" because
-- this ensures we get to the top
--
-- Choices are:
-- keystroke (ASCII character 30) -- up arrow key
-- keystroke (ASCII character 31) -- down arrow key
-- keystroke (ASCII character 29) -- right arrow key
-- keystroke (ASCII character 28) -- up arrow key
keystroke (ASCII character 30)
keystroke (ASCII character 30)
keystroke (ASCII character 30)
-- Down to Disabled
--
keystroke (ASCII character 31)
-- Enter a "return"
key code 36
-- Leave the window open so we can see the state…
--
end tell
end tell
end tell
You can use a similar iCal trick to start and stop Carbonite as well - or even combine these Time Machine and Carbonite scripts into a single AppleScript file.
The "Carbonite" control panel you see in "Systems Preferences" is actually created by the file "com.carbonite.prefpanel" which is located in /Library/PreferencePanes. To control it via AppleScript you need its "real name" - yes this is "Alice in Wonderland". To find this you have to double click it and look inside "Show Package Contents..." at the plist - appropriate name for the Carbonite Control panel is located in the "Bundle Identifier."
Of course this depends on Lion (10.7), not 10.8 which I have not tried it on.
Your mileage will vary....
To find the appropriate "System Preferences" elements to control in AppleScript you can use the script below to find whatever UI elements are available to control:
tell application "System Preferences"
activate
set the current pane to pane id "com.carbonite.prefpanel"
tell application "System Events"
tell process "System Preferences"
set xxx to every UI element of window 1
end tell
end tell
end tell
This will print out the list of items you can script in the "Results" window in the "AppleScript Editor:"
{button 1 of window "Carbonite" of application process "System Preferences" of application "System Events", button 2 of window "Carbonite" of application process "System Preferences" of application "System Events", button 3 of window "Carbonite" of application process "System Preferences" of application "System Events", tab group 1 of window "Carbonite" of application process "System Preferences" of application "System Events", button "Carbonite Help & Support" of window "Carbonite" of application process "System Preferences" of application "System Events", button "Click the lock to prevent further changes." of window "Carbonite" of application process "System Preferences" of application "System Events", checkbox "Click the lock to prevent further changes." of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Carbonite Business Premier" of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Version 1.1.11 build 582" of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Serial Number: 3505391-4391" of window "Carbonite" of application process "System Preferences" of application "System Events", tool bar 1 of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Carbonite" of window "Carbonite" of application process "System Preferences" of application "System Events"}
You can troll through this (replace the commas with newlines) to drill down into the appropriate control structure for controlling Carbonite. You iterate down by finding controls and adding them "set xxx" command.
EDIT: Note there is a problem with the AppleScript for Time Machine as described here - please check out this post for the details.
With that I have set up Time Machine to backup the numerous Macs floating around the office. Most are used as "remotes" from my main development machine and as such its okay to have Carbonite and Time Machine sucking down a huge amount of cycles (which they do).
For example, running two or more of Logic, PhotoShop, Illustrator, Parallels, XCode, etc. usually bog things down to the point of uselessness.
Carbonite usually hums along at about 60% in the background heating up the laptop significantly as well.
So what can you do to fix this?
Of course you can manually diddle with the apps turning them on and off but of course you'll forget at some critical point to turn them back on and poof - two days of work lost!
For me I would like the backups to run at night - say between about 8 PM and 7 AM when I am not using the computer for development. This keeps the worst of it out of my way.
Fortunately there are some relatively simple solutions.
First, in the case of Time Machine you need to create two AppleScripts:
T_M-On.scpt
do shell script "defaults write /Library/Preferences/com.apple.TimeMachine AutoBackup -bool true"
T_M-Off.scpt
do shell script "defaults write /Library/Preferences/com.apple.TimeMachine AutoBackup -bool false"
Next you need to use iCal to set up a daily event starting when you would like backups to begin and ending when you would like them to finish.
Associate the T_M-On.scpt with the start of the event, e.g., 8 PM and T_M-Off.scpt with the end of the event.
So in this example we have set it up to run the Time Machine "Enable" at the start of the event and the "Disable" at the end (in this case 7 AM or so).
I set this to repeat each day.
In the case of Carbonite, which is not built into Mac OS X like Time Machine, you need an AppleScript to access the "System Preferences" and perform the same type of function. Carbonite's control panel is somewhat non-AppleScript friendly so you have to do something like this:
Carbonite-Enabled-Script.scpt:
tell application "System Preferences"
activate
set the current pane to pane id "com.carbonite.prefpanel"
tell application "System Events"
tell process "System Preferences"
-- Carbonite Version 1.1.11 build 582
--
-- Select the "Status" Window
--
click radio button "Status" of tab group 1 of window 1
-- Click the "Backup is: Enabled/Paused pop up
-- to bring up the choice list...
click pop up button 1 of tab group 1 of window 1
-- The choices are Enabled, Paused, in Recover Mode, Disabled.
--
-- So we use the "up arrow" to move to the top of the
-- choice list "Enabled" - we use three "up arrows" because
-- this ensures we get to the top
--
-- Choices are:
-- keystroke (ASCII character 30) -- up arrow key
-- keystroke (ASCII character 31) -- down arrow key
-- keystroke (ASCII character 29) -- right arrow key
-- keystroke (ASCII character 28) -- up arrow key
keystroke (ASCII character 30)
keystroke (ASCII character 30)
keystroke (ASCII character 30)
-- Enter a "return"
key code 36
-- Leave the window open so we can see the state…
--
end tell
end tell
end tell
Unfortunately the version will change and this will break but at least for now this seems to work.
Carbonite-Diabled-Script.scpt:
tell application "System Preferences"
activate
set the current pane to pane id "com.carbonite.prefpanel"
tell application "System Events"
tell process "System Preferences"
-- Carbonite Version 1.1.11 build 582
--
-- Select the "Status" Window
--
click radio button "Status" of tab group 1 of window 1
-- Click the "Backup is: Enabled/Paused pop up
-- to bring up the choice list...
click pop up button 1 of tab group 1 of window 1
-- The choices are Enabled, Paused, in Recover Mode, Disabled.
--
-- So we use the "up arrow" to move to the top of the
-- choice list "Enabled" - we use three "up arrows" because
-- this ensures we get to the top
--
-- Choices are:
-- keystroke (ASCII character 30) -- up arrow key
-- keystroke (ASCII character 31) -- down arrow key
-- keystroke (ASCII character 29) -- right arrow key
-- keystroke (ASCII character 28) -- up arrow key
keystroke (ASCII character 30)
keystroke (ASCII character 30)
keystroke (ASCII character 30)
-- Down to Disabled
--
keystroke (ASCII character 31)
-- Enter a "return"
key code 36
-- Leave the window open so we can see the state…
--
end tell
end tell
end tell
You can use a similar iCal trick to start and stop Carbonite as well - or even combine these Time Machine and Carbonite scripts into a single AppleScript file.
The "Carbonite" control panel you see in "Systems Preferences" is actually created by the file "com.carbonite.prefpanel" which is located in /Library/PreferencePanes. To control it via AppleScript you need its "real name" - yes this is "Alice in Wonderland". To find this you have to double click it and look inside "Show Package Contents..." at the plist - appropriate name for the Carbonite Control panel is located in the "Bundle Identifier."
Of course this depends on Lion (10.7), not 10.8 which I have not tried it on.
Your mileage will vary....
To find the appropriate "System Preferences" elements to control in AppleScript you can use the script below to find whatever UI elements are available to control:
tell application "System Preferences"
activate
set the current pane to pane id "com.carbonite.prefpanel"
tell application "System Events"
tell process "System Preferences"
set xxx to every UI element of window 1
end tell
end tell
end tell
This will print out the list of items you can script in the "Results" window in the "AppleScript Editor:"
{button 1 of window "Carbonite" of application process "System Preferences" of application "System Events", button 2 of window "Carbonite" of application process "System Preferences" of application "System Events", button 3 of window "Carbonite" of application process "System Preferences" of application "System Events", tab group 1 of window "Carbonite" of application process "System Preferences" of application "System Events", button "Carbonite Help & Support" of window "Carbonite" of application process "System Preferences" of application "System Events", button "Click the lock to prevent further changes." of window "Carbonite" of application process "System Preferences" of application "System Events", checkbox "Click the lock to prevent further changes." of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Carbonite Business Premier" of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Version 1.1.11 build 582" of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Serial Number: 3505391-4391" of window "Carbonite" of application process "System Preferences" of application "System Events", tool bar 1 of window "Carbonite" of application process "System Preferences" of application "System Events", static text "Carbonite" of window "Carbonite" of application process "System Preferences" of application "System Events"}
You can troll through this (replace the commas with newlines) to drill down into the appropriate control structure for controlling Carbonite. You iterate down by finding controls and adding them "set xxx" command.
EDIT: Note there is a problem with the AppleScript for Time Machine as described here - please check out this post for the details.
No comments:
Post a Comment