View Full Version : Shell/perl scripting and permissions? FTP

08-29-2006, 06:57 PM
I need to run a shell script to FTP the completed sparseimage backup to an offsite machine (no I can't mount the drive). I'm a reasonable perl coder and have a script that - from the command line - does everything I need. However, when called from SD it dies with an error buried deep within the Net::FTP module code.

Since a simple script that just dumps environment variables works fine when called from SD I suspect it's a permissions problem on the perl modules used. For the perl-savvy amongst you, I can 'use Net::FTP' perfectly well ... so the script can find the correct module. However, creation of the $ftp object ...

$ftp = Net::FTP->new('ip' etc etc);

doesn't even die gracefully, just fails horribly with a cryptic error. Any suggestions? From the ownership of the log files created during debugging (or rather, not debugging) this script it looks as though SD runs as root.

As an aside, are there other users who have a different solution for the same problem - applescript or bash perhaps?


08-29-2006, 11:15 PM
You're running authenticated, David, so perhaps that's causing problems? Have you tried sudoing to your own UID?

Also, if this is run as a post-copy script (in Advanced), the sparse image is still mounted... that might be causing problems, too.

11-16-2006, 03:25 AM
Finally had time to re-visit this ... yes, it's the fact that the drive is still mounted I think. I'm sure I've seen a thread that points to a script that runs upon completion ... i.e. after SuperDuper! unmounts the disk image and is about to exit. However, I can't find it anywhere.

Any pointers?

Does anyone have an example script that FTP's the completed .dmg to another machine. I've made the mistake of investing in a TeraStation NAS with a crippled implementation of Samba (I think that's the culprit) that has a 2Gb file limit. Backing up to the drive isn't an option - I have to backup, FTP and then delete. Urgh!

Many thanks

11-16-2006, 10:41 AM
Are you sure that it's Samba that's the problem here? The Buffalo units have bad AFP implementations that have 2GB file limits, but SMB should work just fine, albeit slowly (the Buffalos are slow-slow-slow)...

11-16-2006, 11:49 AM
You're right ... if they go any slower they'll become extinct. You're also correct ... mounting a disk with afp://123.456.789.012/ works, but I can't see any files larger than 2Gb on the drive. However, doing the same thing but using smb://ip works and I can see the files just fine. This has been bugging me for ages (and I'd even looked on the Terastation forums) - many thanks :) !

So, having solved that, can you point me to the 'just before SuperDuper! exits, after it's unmounted the disk image' script? (if my memory is correct that there is such a thing).

Many thanks for help with SuperDuper! and the NAS box.

11-16-2006, 12:03 PM
You shouldn't need to do this, David, since you can now copy directly to the drive with SMB.

But, if you must, you have two choices. Put your own script in the background and sleep 20 seconds or so before doing anything (or watch for the unmount), or you can modify the applescript... the former is likely going to be easier!