Shirt Pocket Discussions  
    Home netTunes launchTunes SuperDuper! Buy Now Support Discussions About Shirt Pocket    

Go Back   Shirt Pocket Discussions > SuperDuper! > General

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-07-2008, 02:52 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
shell script after copy "cannot execute binary" error

Some time ago, you helped me to write a couple of scripts that would unmount a network share after SD had finished copying to it.

Now I'm trying the same trick at work: back up my user directory to a sparseimage on a network share. Backing up works great. But I'm running into an error with the scripts to unmount the share.

The script, "RunEjectFacStaff", waits 20 seconds and then runs an AppleScript, "ejectFacStaff", to unmount the share.

Code:
#!/bin/sh
nohup /bin/bash -c "sleep 20; osascript /Users/mjg14747/Library/Scripts/ejectFacStaff" &
The script works when run from the terminal. Check.

The permissions on the text file RunEjectFacStaff are:
Code:
-rwxr-xr-x   1 mjg14747  mjg14747  101 Jul  3 10:17 RunEjectFacStaff
They're identical with the permissions for the similar file on my home machine, where this has been working since 2006. So, check (?).

Then I ask SD to run "RunEjectFacStaff" using the third option under "After copy" in the "Advanced" tab. But, alas, here the checks stop.

Code:
| 11:49:04 AM | Error | sh: line 1: /Users/mjg14747/Library/Scripts/RunEjectFacStaff: cannot execute binary file
In short, things look the same to me but I'm getting different results. So I'm clearly missing something. If you could point me in some possible directions, that would be swell.

Thanks!
Reply With Quote
  #2  
Old 07-07-2008, 06:19 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
It certainly seems to think that the script isn't a text file... unless, of course, the script itself is having trouble: does it run in Terminal?
__________________
--Dave Nanian
Reply With Quote
  #3  
Old 07-07-2008, 07:39 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
The script runs from the Terminal fine. Successfully, even.

The Finder calls it a BBEdit text file.
Reply With Quote
  #4  
Old 07-07-2008, 09:21 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
Try "cat"ing it into a separate file with:

Code:
cat /Users/mjg14747/Library/Scripts/RunEjectFacStaff > /Users/mjg14747/Library/Scripts/RunEjectFacStaff2
chmod +x /Users/mjg14747/Library/Scripts/RunEjectFacStaff2
Then set the 'after copy' script to /Users/mjg14747/Library/Scripts/RunEjectFacStaff2.
__________________
--Dave Nanian
Reply With Quote
  #5  
Old 07-09-2008, 01:28 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
No luck; same error.

Error | sh: line 1: /Users/mjg14747/Library/Scripts/RunEjectFacStaff2: cannot execute binary file
Reply With Quote
  #6  
Old 07-09-2008, 01:32 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
I just don't know. Perhaps the other OS files are damaged somehow: an archive-and-install might help.
__________________
--Dave Nanian
Reply With Quote
  #7  
Old 07-09-2008, 01:58 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Oh well. Thanks!
Reply With Quote
  #8  
Old 07-09-2008, 02:42 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Doh. BOM

A minute after giving up, it occurred to me to search the BBEdit lists, where I found the answer. Here is a diagnosis of the problem, my stab at an explanation, and the solution.

I had saved the file with the script encoded as UTF. That means the file had a BOM (Byte Order Mark). Whatever a BOM is, it comes before the #! (I surmise), meaning that the file won't be read as a binary file (I surmise). cat (I surmise) copied that mark so that didn't work either.

Saving the file with a different encoding, UTF without the BOM, solves the problem. My share on the server gracefully disappears after SD is does its thing.
Reply With Quote
  #9  
Old 07-09-2008, 02:46 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
Didn't you say the same file worked on your other Mac, though?
__________________
--Dave Nanian
Reply With Quote
  #10  
Old 07-09-2008, 09:18 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Yes, and when I look at the files on the home computer, they are UTF-no-BOM.

So how did the same file change encoding? My best guess is that I did that. I had to change the paths in the file to match those on the work computer. So I must have altered the encoding when I saved the file.

Thanks!
Reply With Quote
  #11  
Old 07-09-2008, 09:21 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
Glad you've got a handle on it, at least!
__________________
--Dave Nanian
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting from backup guruuno General 27 10-16-2009 11:53 PM
Errors when attempting to clone drive russb General 2 09-01-2007 07:46 AM
error code=3 ACL issue vudutu General 9 12-13-2006 02:32 PM
Copy error and crash offdahook84 General 3 10-01-2005 10:10 PM
Error: No space left on device tradervic General 11 06-29-2005 04:50 PM


All times are GMT -4. The time now is 07:09 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.