Re: Failure with rcp
by Malkavian (Friar) on Oct 26, 2000 at 19:10 UTC
|
At the risk of being too obvious, what happens when you do a test of this exact command from the command line?
Malk
*I lost my .sig. Do you have a spare?* | [reply] |
|
|
it work's spiffy... no problem... which makes me think that rcp is somehow "failing" when run from the child process, but find when run from the command...
magnus
| [reply] |
|
|
So what is the difference between your child process's environment and your shell process's environment? Are you running this script via your shell prompt, or as, say, a CGI script? If the latter, there are tons of different things we can look at, like your PATH, user/ownerships, permissions, etc. If it's something like this:
$ cat script.pl
system("rcp file host:/tmp");
$ rcp file host:/tmp
$ perl script.pl
$
(i.e. both *appeared* to work from this point of view, but in reality, the first rcp command succeeded in producing a file but the second did not), then we probably have a problem.
If your script does not look as simple as the one above, consider reducing it to its simplest components that still reproduce your problem, then give us as much detail about the differences in the way you're running each script and your environment. | [reply] [d/l] |
|
|
|
|
|
Re: Failure with rcp
by vim (Initiate) on Oct 27, 2000 at 17:12 UTC
|
#!/usr/bin/perl -w
use strict;
my ($Local, $Remote);
$Local = q!localfile!;
$Remote = q!user@host:dir!;
system("rcp $Local $Remote");
exit(0);
and it works, copying the localfile in all it's pride and
beauty.
The obvious difference is, that dir is below users $HOME
and not an absolute path. But it works also -- just tested --
for $Remote = q!user@host:/tmp!;
The local system is an old Linux-box -- kernel 2.0.34 -- and
the remote system is a RS/6000, runnig AIX 4.something.
vim | [reply] [d/l] [select] |
|
|
system('rcp', "$Local", "$Remote");
When you feed system the list it stops the shell from getting its grubby hands on it. See system for the exact process that happens when you call system.
<myExperience>
$mostLanguages = 'Designed for engineers by engineers.';
$perl = 'Designed for people who speak by a linguist.';
</myExperience>
| [reply] [d/l] [select] |
|
|
Woo Hoo!! It worked!!! 64 Slices of American cheese for you, sir!! Thanks... btw, i haven't seen the q!..! syntax before... what's it mean?
Update:without meaning to be a -- magnet, i wanted to remark that through another script, i found that the problem with this script was, i wasn't close (FILE) before i rcp'ed... *sigh*... code and learn...
| [reply] [d/l] |
|
|
q/.../ is identical to '...', or a single-quoted string. See perlop.
Perhaps you were using double-quotes, and something in your string got interpolated, breaking it? That's why I kept trying to get you to test your assumptions, specifically: that these variables held the values you were expecting. That's why my examples had no variables at all, and I kept saying that if your example was any more complex than that (included variables, for example), then that additional complexity was almost certainly to blame. If I'm understanding all of this, it was.
| [reply] [d/l] [select] |
Re: Failure with rcp
by Fastolfe (Vicar) on Oct 26, 2000 at 19:07 UTC
|
If it actually creates the file in $host:/tmp, but the file is zero length, I would suspect that this is a problem with rcp. Are you getting any error messages, or are you discarding STDERR? I find it doubly odd that rcp wouldn't give you an error. | [reply] [d/l] |
|
|
i'm getting no error messages, with or without STDERR... which makes it frustrating... =)
magnus
| [reply] |
RE: Failure with rcp
by geektron (Curate) on Oct 27, 2000 at 01:46 UTC
|
| [reply] [d/l] |
|
|
thanks... this doesn't seem to be the problem... everything works great from the command line (ie: parent process)... it's only when the rcp is called from the perl script that it's not working... even if the rcp is in a ksh script called by the perl script... magnus
| [reply] |
Re: Failure with rcp
by FouRPlaY (Monk) on Oct 26, 2000 at 20:56 UTC
|
Based on my own experience, I had to create an empty file (I used touch) before I sent any information to it. I don't know how helpful this is, but it may be worth a shot. | [reply] |
|
|
thanks, FouRPlaY... unfortunately, didn't work... sigh...
| [reply] |