[Omaha.pm] perl or system problem?

Andrew.Hadenfeldt at alltel.com Andrew.Hadenfeldt at alltel.com
Thu Oct 21 09:30:00 CDT 2004


Most likely it's a PATH problem. Cron doesn't set up much for an environment so you have to do it. You should be getting an email from cron to that effect ("pprosvc: not found"), assuming you haven't redirected STDERR in cron.

My preferred solution is to write a small, generic wrapper script (e.g., "runcron myscript.pl") that sources .profile, sets PATH, etc., and then does an "exec $1" to run the actual script. Also, remember you don't have a tty in cron so avoid stty or similar commands that assume you're interactive.

-Andy
-----Original Message-----
From: omaha-pm-bounces at mail.pm.org
[mailto:omaha-pm-bounces at mail.pm.org]On Behalf Of Terry
Sent: Thursday, October 21, 2004 9:14 AM
To: Perl Mongers of Omaha, Nebraska USA
Subject: [Omaha.pm] perl or system problem?


Hello,

I have a hunch this is something to do with my environment .....

I am running this program out of cron:

#!/usr/local/bin/perl

use Mail::Sendmail;

$hostname = `hostname`;
$message = `pprosvc -n -l`;
unshift @{$Mail::Sendmail::mailcfg{'smtp'}} , 'plasmtp';
%mail = ( To      => 'jo at hotmail.com',
        From    => "admin\@$hostname",
        Subject => 'available packages',
        Message => "$message"
);
sendmail(%mail) or die $Mail::Sendmail::error;


When I run it interactively on the command line, it works fine.  It
gives me a full output ($message).   When I run it out of cron,
$message is empty......why?   OS Is obviously Solaris.

Here is usage for that program:

usage: pprosvc [-d | -i [-n] | -l] [-h] where:
   d means download all patches.
   i means install required patches.
   l means list required patches.
   n means operate in non interactive mode.
   h display usage information.


Thanks!
Terry
_______________________________________________
Omaha-pm mailing list
Omaha-pm at mail.pm.org
http://www.pm.org/mailman/listinfo/omaha-pm
******************************************************************************************
The information contained in this message, including attachments, may contain 
privileged or confidential information that is intended to be delivered only to the 
person identified above. If you are not the intended recipient, or the person 
responsible for delivering this message to the intended recipient, ALLTEL requests 
that you immediately notify the sender and asks that you do not read the message or its 
attachments, and that you delete them without copying or sending them to anyone else. 




More information about the Omaha-pm mailing list