PDA

View Full Version : Shell Script before Backup: time limit ?


Harry Cover
04-22-2008, 12:47 AM
Hello Dave,

I have a smart BU schedule (cloning HD A -> B), starting after an Applescript (advanced Shell script before BU option).
This script copies a large folder to HD A (folder copy HD C -> A).
I have tested it but it fails.

What could have happened ?
Is there a time limit SD can wait, before starting its job ?
In that case, what is the time limit ?
What could be the solution ?

Thanks in advance.
Regards?

dnanian
04-22-2008, 09:31 AM
Fails how? I don't really have much information here...

Harry Cover
04-22-2008, 02:31 PM
Fails how? I don't really have much information here...

Sorry.

More details:
1 - The preliminary copy (Applescript) did not complete. Don't ask me why...
2 - SD did not start its own smartBU.

dnanian
04-22-2008, 04:27 PM
I'd need to see the log, Harry; can you send it into the support email address?

Harry Cover
04-23-2008, 03:21 AM
I'd need to see the log, Harry; can you send it into the support email address?

OK, Dave.

I'll do that as soon as possible.

Alternatively, I could independantly schedule the Applescript initial copy, with Cron (outside SD), and then schedule SD secondary copy script, after the initial AS completion.

Thanks for your help.
Regards.

dnanian
04-23-2008, 08:35 AM
Sure, you can do that.

Harry Cover
04-23-2008, 01:25 PM
I'd need to see the log, Harry; can you send it into the support email address?

Here comes the error log:
<| 07:07:24 PM | Error | sh: line 1: /Users/Medecins/Documents/AppleScripts perso/Satur.SAUV 1.0.scpt: Permission denied>

Today no copy task was performed.
Neither the Applescrit one, nor the SD one... :confused: :eek:

Thanks for your superb support, Dave.

dnanian
04-23-2008, 03:20 PM
OK. That's not really a shell script. You need to create a shell script that runs that -- e.g:

#!/bin/sh
osascript "/Users/Medecins/Documents/AppleScripts perso/Satur.SAUV 1.0.scpt"

Harry Cover
04-23-2008, 03:33 PM
Great !
I will test that tomorrow.

I apologize.
Now, I know there is a différence between a simple AS and a shell script. :o

Thanks again.

Harry Cover
04-25-2008, 12:20 PM
My problem is not solved.:confused:

If I am in the Terminal:

---
osascript "/Users/Medecins/Documents/AS.perso/Sat.BU.scpt"
---

The job is perfectly done.

Now, if I am in SD and launch the shell script (before a SD BU option):

---
#!/bin/sh
osascript "/Users/Medecins/Documents/AS.perso/Sat.BU.scpt"
---

SD stops when launching the shell script.

Log:
----
| Error | sh: line 1: /Users/Medecins/Documents/AS.perso/TShirtBU: Permission denied
----

Any hint ?
Thanks in advance.

dnanian
04-25-2008, 01:09 PM
You need to set the script permissions to allow execute:

chmod +x the-file-name

Harry Cover
04-25-2008, 02:39 PM
Does the script become:

---
#!/bin/sh
osascript "/Users/Medecins/Documents/AS.perso/Sat.BU.scpt"
chmod +x "Sat.BU.scpt"
---

As you can see I am real shell script newbie...
Sorry and thanks agian.

dnanian
04-25-2008, 03:01 PM
No, the "chmod" is done in Terminal, to give the script file execution permission. This is the script you've written (hopefully as a plain text file), not the applescript.

Harry Cover
04-26-2008, 02:20 AM
No, the "chmod" is done in Terminal, to give the script file execution permission. This is the script you've written (hopefully as a plain text file), not the applescript.

As I previously said.
I have no issue in Terminal, even without the "chmod".

The issue only occurs when SD reads the shell script (->permission denied).

I do not knom if this permission problem has to be settled in the shell script or the Applescript. It seems it is rather a shell sript problem, rather than an Applescript one.

Alternatevely, I could write a pure vanilla shell script, using the "rsync" command, but I am afraid of other new scripting issues.

Any hint ?
Thanks in avance.

dnanian
04-26-2008, 09:37 AM
It must not be readable or executable. So:

chmod +rw /Users/Medecins/Documents/AS.perso/TShirtBU

Harry Cover
04-26-2008, 11:10 AM
I have tried unsuccessfully:

---
#!/bin/sh
chmod +rw /Users/Medecins/Documents/AS.perso/TShirtBU
osascript "/Users/Medecins/Documents/AS.perso/Sat.BU.scpt"
---

and

---
#!/bin/sh
osascript "/Users/Medecins/Documents/AS.perso/Sat.BU.scpt"
chmod +rw /Users/Medecins/Documents/AS.perso/TShirtBU
---

A lonesome desesperate Shell scripter

dnanian
04-26-2008, 11:35 AM
No: the script itself should only be


#!/bin/sh
osascript "/Users/Medecins/Documents/AS.perso/Sat.BU.scpt"


You then set this FILE as executable, in Terminal, with:


chmod +rw /Users/Medecins/Documents/AS.perso/TShirtBU

Harry Cover
04-26-2008, 01:59 PM
I did it your way... ;)

and got the log error:
---
| Error | sh: line 1: /Users/Medecins/Documents/AS.perso/TShirtBU: Permission denied
---

:mad:

dnanian
04-26-2008, 05:47 PM
And what happens if you run

/Users/Medecins/Documents/AS.perso/TShirtBU

in Terminal?

Harry Cover
04-27-2008, 12:49 AM
And what happens if you run

/Users/Medecins/Documents/AS.perso/TShirtBU

in Terminal?

You mean just pasting

---
/Users/Medecins/Documents/AS.perso/TShirtBU
---

and return key ?

06:48 AM here.
I am just leaving for the south of France (loooong walking trip) and will reply in a week.
See you...

Thanks again Dave.

dnanian
04-27-2008, 08:14 AM
That's what I mean: that will run the shell script.

Harry Cover
05-05-2008, 04:00 PM
And what happens if you run

/Users/Medecins/Documents/AS.perso/TShirtBU

in Terminal?

I'm back, and answer your question immediately.
I get this in Terminal:

---
-bash: /Users/Medecins/Documents/AS.perso/TShirtBU: Permission denied
---

dnanian
05-05-2008, 06:40 PM
OK. Now run:


ls -l /Users/Medecins/Documents/AS.perso/TShirtBU

(That's LS -L in lower case)

Harry Cover
05-06-2008, 06:13 AM
OK. Now run:


ls -l /Users/Medecins/Documents/AS.perso/TShirtBU

(That's LS -L in lower case)

Done:

--> In Terminal
---
Last login: Tue May 6 12:03:41 on ttyp1
Welcome to Darwin!
imac-m-dical:~ Medecins$ ls -l /Users/Medecins/Documents/AS.perso/TShirtBU
-rw-r--r-- 1 Medecins Medecins 68 Apr 26 19:38 /Users/Medecins/Documents/AS.perso/TShirtBU
imac-m-dical:~ Medecins$
---

--> Then in SD (log)

---
| 12:06:05 PM | Error | sh: line 1: /Users/Medecins/Documents/AS.perso/TShirtBU: Permission denied
---

dnanian
05-06-2008, 08:04 AM
And, it has no execute permission, which is where we started. Run:

chmod +x /Users/Medecins/Documents/AS.perso/TShirtBU

then

ls -l /Users/Medecins/Documents/AS.perso/TShirtBU

and it *should* say:

-rwxr-xr-x 1 Medecins Medecins 68 Apr 26 19:38 /Users/Medecins/Documents/AS.perso/TShirtBU

Harry Cover
05-06-2008, 01:23 PM
OK, Dave.
I'll try it tomorrow (Mac concerned is at my business), and tell you.

Harry Cover
05-07-2008, 06:32 AM
And, it has no execute permission, which is where we started. Run:

chmod +x /Users/Medecins/Documents/AS.perso/TShirtBU

then

ls -l /Users/Medecins/Documents/AS.perso/TShirtBU

and it *should* say:

-rwxr-xr-x 1 Medecins Medecins 68 Apr 26 19:38 /Users/Medecins/Documents/AS.perso/TShirtBU


It diiiiiiiiiid !!!!
EUREKA !!!

Could you explain what was THE issue ?
Could it happen again ?

Many thanks Dave.

dnanian
05-07-2008, 10:29 AM
I don't know: I asked you to do that many messages ago and for some reason it didn't work...