in reply to system() and backticks not working

What's strange is that this worked a month ago and doesn't work anymore

Did you make any changes to the system in the last month?

If I take the command and run in a command window, everything is OK

Just a wild guess, perhaps you have installed some program that has changed your windows profile or something like that, so that the secure copy pscp can not pick up your private key any more? Or perhaps your PATH has been modified in the last month so your script can not pick up the pscp.exe program any more?

I've tried running the command using backticks too, but nothing happens there either

That would not help because your problem is most likely related to scp settings.

The script is run silently at regular intervals using a cron replacement for windows and wperl.exe

Did you include some debugging/logging facility in your script? Do you have a log file?

The following are a few suggestions for tracing the problem:
1) check the return result of system command system("pscp ....") or { open $log, ">C:\pscp.log"; print $log "Can not execute the pscp command."; close $log; exit(1); } 2) add -v (verbose) option to your pscp command to print more info. redirect output of your pscp command to a log file. system("pscp .... -v >> c:\pscp.log 2>&1");

Replies are listed 'Best First'.
Re: Re: system() and backticks not working
by Jobby (Monk) on Jan 31, 2004 at 18:15 UTC

    Thanks very much for your help - in particular your suggestion to redirect the output of pscp. It turned out that the cron replacement I was running launches programs as a different user to the current one, so when pscp was exectured it looked for a cached server key in the registry that didn't exist for that user. I changed it by going into Services and changing the 'Log On As...' options for it. The thing I changed in the last month was reinstallation of the cron replacement. Thanks again!