On 3/7/06, Adrian Diezig <[EMAIL PROTECTED]> wrote: > system "su - qipadmin -c 'rsync -e ssh -p > $otherip:/opt/named/current/conf/db.* /opt/named/current/conf --exclude > *.jnl*'"
Since there are shell metacharacters in that string, Perl will pass it to the shell for handling. The Perl part seems okay, assuming that $otherip doesn't contain any odd characters. (It doesn't seem to.) That means that your Perl program is launching a shell, the shell is launching su, su is launching another shell, that shell is launching rsync, and rsync is launching ssh. I hope I didn't miss any. There's a lot of room for miscommunication there. Although I can't see anything that I'm sure is the problem, I'm suspicious of su calling the second shell, since I've had trouble with quoting arguments to su in the past; could that be tampering with your arguments? Here's the hack I've used in the past to diagnose this kind of launch arguments problem: I replace the called program (rsync, in your case) with tellargs. That's a small program that just numbers and prints out its command line arguments, so that you can see exactly how you're calling it. Then you keep fudging with the quoting until you've got it right. But you might be better off not launching any shells you don't have to. If you call system() with a list of arguments, the first is the program name to run, and the rest are the arguments. That avoids the first shell, since you can run /bin/su directly. Does that help? > rsync copies the files but the problem is, that the rsync command never > exits (is hanging) and so the script cannot continue (unless I do manual > kill of the rsync process): That's bad. Could it be trying to get user input for some reason, after copying the files? > On the command line I can do the following without any problems (rsync exits > successfully): > > su - qipadmin -c 'rsync -e ssh -p 10.10.1.242:/opt/named/current/conf/db.* > /opt/named/current/conf --exclude *.jnl*' Well, that sure LOOKS like the same command. Just to touch all the bases, let's run down some things that could be different. Your working directory, environment variables, or user ID. The shell (Perl uses /bin/sh). The standard filehandles. Well, this gives you a lot to try. Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>