I’m having a very strange error.
I run a perl script which executes linux commands. They are executed like this:
my $err = `cp -r $HTML /tssobe/www/tstweb/$subpath/$HTMLDIR1`;
myLog("$err");
And $err is empty, which mean the command didn’t return and error. (right?)
I tried to execute the linux command with exec “” or system (), but no success.
I tried to change the path. Same.
Also, I tried to run only the cp command in a new perl script. It works.
But not in my full perl script.
In this perl script, some commands are working, some are not.
The script was working yesterday, Not anymore this morning. No changes have been made in the meantime.
I tried a lot of things, I would be glad if anybody has an idea.
EDIT:
The server was having a lot of processes unterminated. Cleaning those solved the problem.
So the problem is related to another application, but I’ll improve the logging thanks to your comments.
Small problem: you are NOT capturing STDERR, so you won’t see the error (you are also not checking
$?return code).You should do
to redirect STDERR to STDOUT, or use one of the modules for running commands.
Large problem:
You should not run system commands from Perl for which Perl-native modules exist. In this case:
File::Copy::Recursivemodule.You can also roll your own directory copied from
File::Copy.