Issue with Cron and Perl Script Variables

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2007
Posts: 34
Reputation: skelly16 is an unknown quantity at this point 
Solved Threads: 0
skelly16 skelly16 is offline Offline
Light Poster

Issue with Cron and Perl Script Variables

 
0
  #1
34 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 237
Reputation: katharnakh is an unknown quantity at this point 
Solved Threads: 33
katharnakh's Avatar
katharnakh katharnakh is offline Offline
Posting Whiz in Training
 
0
  #2
31 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 34
Reputation: skelly16 is an unknown quantity at this point 
Solved Threads: 0
skelly16 skelly16 is offline Offline
Light Poster
 
0
  #3
31 Days Ago
Originally Posted by katharnakh View Post
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.
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the Perl Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC