PDA

View Full Version : Getting SD to Allow Sleep after Copy


Pixx
02-19-2005, 12:09 PM
Hi,

Following on from your comment to my post on VT, (where I suggested you add some options to SD to allow the Mac to be put to sleep or closed down after copying) the suggestion you made of adding a custom shell script:

osascript -e "tell application \"finder\" to sleep"

isn't working - SD gives an error like "Error while invoking customization script [path]'.

I've copied the line of text above into a simple text file and navigated to the text file in Options -> Run Customization Script to set it in SD.

Do I need to create a different sort of file (ie. with a different extension), or do I need to place the text file somewhere in particular?

Thanks

dnanian
02-19-2005, 12:22 PM
Hi, Pixx -- glad you were able to make it here to the forums.

Place this in a file, with the first line:

#!/bin/sh

Then, execute the following command (in Terminal):

chmod +x filename

where "filename" is the name of the file you used. I'd make the extension "sh" to make it clear that this is a shell script.

Test it by running ./filename.sh in Terminal: it should put the system to sleep.

Once you've completed testing that way, then set this file as the customizations script, and you should be golden. Let me know.

Pixx
02-19-2005, 01:54 PM
Thanks Dave,

It works from terminal fine now (although not using ./filename - you need to drag + drop the file onto terminal to get the correct path) so I expect it should work on the next synch run.

After doing some digging, the original error in console was:

2005-02-18 00:15:32.812 SuperDuper![1043] ***ERROR OCCURRED: sh: line 1: /Applications/SuperDuper/superduper_sleep_script: Permission denied

2005-02-18 00:15:32.814 SuperDuper![1043] ***ERROR OCCURRED: ****FAILED****: result=32256 errno=1 (Operation not permitted)

So I imagine your 'chmod +x' made the difference by adding 'Execute' permissions.

I'll report back to confirm it worked - but it would be lovely to have sleep/shutdown as options in 'On Completion' in v 2.0

Thanks again. :)

dnanian
02-19-2005, 02:13 PM
Sorry: made an assumption that it was in the current directory. My mistake, Pixx!

(If it *is* in the current directory, you'd think you could execute it by just typing its name, but you can't -- you have to say "./filename", where "." is the current directory. Was just trying to help with that case.)

Definitely have some additional options planned for v2.0. Stay tuned.

Pixx
02-19-2005, 08:30 PM
Hi Dave,

SD has just run but didn't let the Mac sleep.

SD Error was the same - 'error in customization script'.

Here's the log entry:

|11:49:14 PM|Info| ...ACTION: Execute Site Customization Script /Applications/SuperDuper/superduper_sleep_script.sh
|11:49:14 PM|Info| ......COMMAND => Invoking site customization script: /Applications/SuperDuper/superduper_sleep_script.sh
|11:49:21 PM|Error| 29:34: execution error: Finder got an error: Application isn't running. (-600)

The script has this:

#!/bin/sh
osascript -e "tell application \"finder\" to sleep"

The path in SD is correct, and (as I said above) the script runs from terminal fine.

Have I missed something?

Thanks

:)

dnanian
02-19-2005, 08:38 PM
OK -- sounds like osascript doesn't want to let you script it directly. Interesting.

Instead, try putting those commands in an Applescript, compile to an executable using Script Editor, and then change the command to "/usr/bin/open script-name", i.e.:

#!/bin/sh
/usr/bin/open /Applications/WhateverMyScriptIs

(You'll have to quote it if there are strange characters or spaces. Again, test in Terminal first.)