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.

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,
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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.