Thread

Posted on Tue Nov 28 17:35:22 2006 by chiarappadomenico
Problem with UNIX crontab
Hi, when I launch my perl script manually, it works very good but when I used crontab for scheduling the script, I have this output:
From x2693 Tue Nov 28 16:28:02 2006 Return-Path: <x2693> Received: (from x2693@localhost) by suncbk11.far.it (8.11.7p1+Sun/8.11.7) id kASFS2313312 for x2693; Tue, 28 Nov 2006 16:28:02 +0100 (MET) Date: Tue, 28 Nov 2006 16:28:02 +0100 (MET) From: x2693 Message-Id: <200611281528.kASFS2313312@suncbk11.bgl.lu> To: x2693 Subject: Output from "cron" command Content-Type: text Content-Length: 264 Your "cron" job on suncbk11 /usr/local/bin/perl /export/home/x2693/project/v02/appliancemanagement.pl produced the following output: Can't call method "expect" on an undefined value at /export/home/x2693/project/v02/FWcheckpoint.pm +line 127, <FWMODEL> line 57.
P.S. In the line 127 I call the first time expect. Following some lines of the scripts:
line 126 my $ssh = Expect->spawn("ssh -l $User $Host"); line 127 unless ($ssh->expect($Time_ex,-re,$Prompt)) {$self->send_alarm($Action);}
Direct Responses: 3640 | 3657 | Write a response
Posted on Tue Nov 28 17:59:14 2006 by rana in response to 3639
Re: Problem with UNIX crontab
it is sort of unlikely that you notice an error when using cron and not when used manually, still; try this module Schedule::Cron instead of regular cron,
try running in debug mode and step thru the process, or write a loging functionality so you log every thing to a log you can review the process as it flows.
the cron jobs that I have are setup to direct the std output to a log file / dump file, as cron sends all the errors to the mailbox.
hope this helps, Rana
Direct Responses: 3641 | 3642 | Write a response
Posted on Tue Nov 28 18:15:17 2006 by chiarappadomenico in response to 3640
Re: Problem with UNIX crontab
Thanks Rana, I'll try to use Schedule::Cron... Have a good day!
Write a response
Posted on Tue Nov 28 18:27:34 2006 by chiarappadomenico in response to 3640
Re: Problem with UNIX crontab
Thanks Rana, I'll try to use Schedule::Cron... Have a good day!
Direct Responses: 3654 | Write a response
Posted on Wed Nov 29 10:23:00 2006 by chiarappadomenico in response to 3642
Re: Problem with UNIX crontab
I've always the same problem... Someone can help me? Thanks!
Write a response
Posted on Wed Nov 29 15:37:32 2006 by rgiersig in response to 3639
Re: Problem with UNIX crontab

Well, seems that the spawn failed and returned an undef value. You don't believe in error-checking, do you? :o)

I would guess that ssh is not in the PATH that crontab gives to its scripts. Try -w or 'use warnings;' and you might get an error message...

Write a response