944,110 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 1129
  • Perl RSS
Oct 30th, 2009
0

Issue with Cron and Perl Script Variables

Expand Post »
Hi All

Im very new to perl scripting coming from a shell background, but im determine to stick to it and learn perl.

I have env variables which i have defined in my perl script and work fine from command line as these env variables are in my profile. When i get cron to run the script i dont believe these variables are being used and causing my script to not pull back data.

[
#!/usr/bin/perl -w
#
#
use strict;

$ENV{'AUTOSYS'} = "/opt/autosys/P22";
$ENV{'AUTOSERV'} = "P22";
$ENV{'AUTOTREE'} = "/opt/autosys";
$ENV{'AUTOUSER'} = "/opt/autosys/P22/autouser";
]

Any guidance or help would be most appreciated.
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007
Nov 2nd, 2009
0
Re: Issue with Cron and Perl Script Variables
Hi,
is your cron job created for the same usr as you use to run the script? If yes, in my opinion, the env variables should get assigned with new values. Also note that these env variables you set in the script will be available till executing script ends.

katharnakh.
Reputation Points: 19
Solved Threads: 34
Posting Whiz in Training
katharnakh is offline Offline
237 posts
since Jan 2006
Nov 2nd, 2009
0
Re: Issue with Cron and Perl Script Variables
Click to Expand / Collapse  Quote originally posted by katharnakh ...
Hi,
is your cron job created for the same usr as you use to run the script? If yes, in my opinion, the env variables should get assigned with new values. Also note that these env variables you set in the script will be available till executing script ends.

katharnakh.

Hi i created a cron entry for my id so it is the same user. Still dont know why this env variables dont get involved in the script.
Reputation Points: 10
Solved Threads: 0
Light Poster
skelly16 is offline Offline
34 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Need help writing a perl script to parse multiple files
Next Thread in Perl Forum Timeline: Perl regex





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC