biswanath_c has asked for the wisdom of the Perl Monks concerning the following question:


Hi,


There is a PERL script that i am using to map to a remote folder and pull in some files. I get the remote folder path as a command-line argument and assign it to a variable $strPath and i check if the folder exists like this:

unless (-d $strPath ) { print LOG "Folder $strPath does not exist! \n"; die; }


This line does not return an eror (i.e., it is able to detect the remote folder) when i run the perl script from command line. But the same line throws an error (folder does not exist - which means the sciprt is NOT able to detect the remote folder) when the same script is run from within a scheduled task.


Why this difference of behaviour of the SAME perl script if it is run from a scheduled task?!

Thanks and regards

Biswanath

  • Comment on Different behaviour when a PERL script is run from within a scheduled task!
  • Download Code

Replies are listed 'Best First'.
Re: Different behaviour when a PERL script is run from within a scheduled task!
by Corion (Patriarch) on Mar 26, 2009 at 21:55 UTC

    Most likely the account your scheduled task runs as (SYSTEM or something like that) does not have the necessary permissions to access network resources. Change the account the scheduled task runs as.

Re: Different behaviour when a PERL script is run from within a scheduled task!
by targetsmart (Curate) on Mar 27, 2009 at 07:42 UTC
    might be absolute and relative path issue?. try giving full absolute path. it is just a guess.

    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
Re: Different behaviour when a PERL script is run from within a scheduled task!
by mikelieman (Friar) on Mar 27, 2009 at 18:52 UTC
    Cron doesn't automatically pull in the user's .profile.