PDA

View Full Version : scripts


rdlsmith
08-08-2006, 09:47 PM
I have a simple applescript that I want to run after the backup process. I get different errors.

In one case SD! said it couldn't find the file. I saved the AppleScript as an application and had the hide extension box selected. Thinking that might have something to do with it, I saved the script as a 'script' and then SD! complained that it didn't have permission.

In those cases, I was just trying to run a script that did nothing but:

say "hello, got this far"

I just wanted to prove I could kick off the script.

What's the secret to running a script after SD!

Thanks

rdlsmith
08-08-2006, 10:41 PM
Okay, I wrote a AppleScript Application that checks to see if SD! is running and as long as it is, don't try the unmount. Otherwise, unmount the drive.

It looks as though this time SD! called the script! That's the good news. The bad news it, it never returned from the script. The script wouldn't close because SD! was open. SD! wouldn't continue because the script was still running.

So how do I get SD! to just kick off the script and continue or better yet, kick off a script after it finishes everything it has to do.

Thanks

dnanian
08-09-2006, 03:18 AM
You'd have to put the script in the background and "nohup" it...

rdlsmith
08-09-2006, 07:35 AM
You'd have to put the script in the background and "nohup" it...

I'm sorry Dave, I'm afraid I can't do that. What is "nohup"?

I called the unmount script from an iCal schedule and it seemed to work. So at least I have a solution. Not sure it's the right way to go about it but I just don't see how those before and after scripts are used from within SD!.

I'd rather call the AppleScript from SD! only when it's needed.

dnanian
08-13-2006, 10:03 AM
nohup is a Unix command that prevents a command from aborting when its parent process exits. So, you'd do something like:

#!/bin/sh
nohup /bin/bash -c "sleep 10; osascript /a/path/to/some/script/file" &

That'd put a background process in place that would sleep for 10 seconds, then run a script.