Scripts not nunning in CRONTAB

hi,

i need to run one script in cron...
in that script has connect antoher server and doing sftp for file transfer to another script.
and going to be run another script in another server

ssh ravikus\@server2 /export/home/ravikus/scripts/GetDetailsC2b.sh

it is work fine when i run directly....if i a placed in cron the script it is not run.

is it sftp and ssh connection problem?
and also i have enabled SSH authentication for server2
please help me

Regards,
Siva.....

please use search ond/or the faq before posting:

I just realized we have a cron FAQ <edit> FAQ section. (seriously, I didn't know :eek:).

In general, one of the most common mistakes when using cron is understanding the limited environment in which a cron job runs.

ya.. i have checked in FAQ but still not understanding what is wrong...:mad:

What is the content of the your script GetDetailsC2b.sh

#!/usr/local/bin/perl
#DB CONNECTION
use Oraperl;
use DBI;
$ENV{"ORACLE_HOME"} = "/oracle/8.1.7";
$sUsername = "s3\@cdb";
$sPassword = "5e";
$hConnection = &ora_login("", $sUsername, $sPassword)
                               or die "\nCould not Connect DATABASE \n ERROR DETAILS \n *************\n $DBI::errstr";
open (OUTFILE, '>/export/home/ravikus/scripts/in.txt');
$ f1= "/export/home/ravikus/scripts/input.txt";
open(f1) or die("Could not open test file.");
foreach $user (<f1>) {
chop($user);
$hQuery = &ora_open($hConnection, "select name from domain where name='$user' and mail_domain='O' and hostname='www'")
 or die "\nWARNING...Check whether the $user Domain IS EXISTS in C2B DB.\n ERROR DETAILS \n *************\n $DBI::errstr";
@asQueryReturn = &ora_fetch($hQuery);
#if($REFCNT != 1)
#{
if(@asQueryReturn != 0)
{
$nme = $asQueryReturn[0];
#$llg = $asQueryReturn[1];
#$cre = $asQueryReturn[2];
#chop($nme);
#chop($sts);
print OUTFILE "$nme \n";
@asQueryReturn = &ora_fetch($hQuery);
}
#else
#{
#print "The $user USER NAME is not found in C2B Database\n";
#}
#}
&ora_close($hQuery);
} #END FOR LOOP
close(OUTFILE);
close(f1);
&ora_logoff($hConnection);

Hmm. Would have expected a Pearl script to have file extension ".pl".

We need a mother script in unix Shell to set all the environment variables such as "ORACLE_HOME" and "DBI". There will be more for Oracle than just ORACLE_HOME.

It would help to know the account which is running this script, the normal contents of ".profiile" for that account, the normal respones to "set", and anything else which might affect the environment before running the script from a command prompt.

The exact cron username and crontab line will be helpful after dealing with the main issue (environment).