• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

cronjob

i have a cronjob that runs  rahul.pl

rahul.pl contains

$string .= "\nTesting\n";
#$string =~ s/\n/\\\n/g;
#$string =~ s/'/'"'"'/g;
system "ssh", "out1", "/u/rshah1/temp.pl", "'$string'";


it does not works it does not login to out1 machine

however if i run rahul.pl manually from command prompt it works fine. i have set up sshkeygen

0
shahrahulb
Asked:
shahrahulb
2 Solutions
 
shahrahulbAuthor Commented:
ssh is not working thru cronjob
0
 
jmcgOwnerCommented:
There are a variety of differences between the environment a process sees when it is run from the command line and the environment it sees if it is executed as a cron job.

The first question I'd have to ask is whether the cron job is running on your behalf. The ssh keys are user-specific.
0
 
manav_mathurCommented:
I;d probably also code the entire path to the ssh command in your system(). As jmcg has explained, PATH is one environment variable which is not available when a script is run thru cron

system "/absolute/path/to/ssh", "out1", "/u/rshah1/temp.pl", "'$string'";
0
 
chemdryCommented:
Make sure that your pl has the approriate attributes. chmod it to 755 or else the cronjob wont't have authority to execute it.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now