cron job is not working for two scripts

Hi Gurus,

I have a test unix server in which currently some unix cronjob are running.
I have written two script one is a shell script in which env variable are there (in that i am exporting those variables).
I have also written a perl script .

when i am running at the shell manually like below it is working fine.

.  /dir1/dir2/script.env; /dir1/dir2/script.pl

but when i am running for every minute by the help of cron job.

I mean when i am adding this above job in "crontab -e" like below.

* * * * *  .  /dir1/dir2/script.env; /dir1/dir2/script.pl

I dont know after every minute i am checking the corresponding log but it seems it is not working.

but when i am adding a job like this

* * * * * echo hell>>/dir/file1

it is working fine.but dont know why it is not happening in the above perl script case.

Waiting for your reply.

Regards,
Sanjay.

Is it executable chown
with the #! first line pointing at perl?
Does it need a tty?

everything is set properly, it is executable ,#! added for perl ,it does not need tty.

when i told it is working fine at prompt. your questions dont make any sense.

hi gurus please guide me why it is not working.
no luck.

regards,
sanjay

Redirect stdout and stderr from your script to some log file and check once. Possible error might be captured.

hi gurus,

I would like to give more details about the problem how the cronjob is not running.

priviously the cronjob entry was like below

. /dir1/dir2/cron_test.env;/dir1/dir2/transfer_file_to_target_updatedone.pl

actually in the second file which is perl file the initial lines looked like

 
#!/opt/perl/bin/perl -I/opt/perl/lib/site_perl -I/opt/perl/lib
use strict;
use Net::SFTP;
use Net::SFTP::Util qw (fx2txt);
use Net::FTP;
use Data::Dumper;
use DBD::Oracle qw(:ora_types);
use MIME::Lite;

But now though we are using the scp to include in the perl file
we are include one module in the perl file (in sence ,we have added a line" use Net::SCP::Expect;"like below) and the current initial lines looks like

#!/opt/perl/bin/perl -I/opt/perl/lib/site_perl -I/opt/perl/lib
use strict;
use Net::SFTP;
use Net::SFTP::Util qw (fx2txt);
use Net::FTP;
use Net::SCP::Expect; 
use Data::Dumper;
use DBD::Oracle qw(:ora_types);
use MIME::Lite;

and inside the pl we are using scp for secure copy.

now I think i got the problem due to this additional module which we added in the perl script that is making the cron job not running (but first .env script is working in both of cases"as it before and now").

I think some where cron is mainting these modules for "scp"(which should be added in cron list).

I have tried a lot it is not working(as a developer i am not accesed to open cron log) after implemented the "use Net::SCP::Expect; " (think should be added somewhere in cron list which should be done by unix admin).

Waiting for your reply

Sanjay.

First, #! can only have one argument, like "#!/usr/bin/sed -f", see man execvp. Maybe make a shell script wrapper for your perl call, so you can have any command line you want. I get very little use out of anything but #!/usr/bin/ksh or the bash equivalent. I find I can test/enhance better with a wrapper.

Make your cron command log somewhere permanent, so you can see if it has anything to tell you:

( echo Start CL1 `date` ;  /dir1/dir2/cron_test.env ; echo "Env done, start pl" ;  /dir1/dir2/transfer_file_to_target_updatedone.pl ) >>/var/tmp/cron.log 2>&1