> -----Original Message----- > From: Telemachus [mailto:[EMAIL PROTECTED] > Sent: Saturday, November 08, 2008 6:13 AM > To: beginners@perl.org > Subject: Re: Cron environment for execution of Perl script > > On Thu Nov 06 2008 @ 3:42, Wagner, David --- Senior > Programmer Analyst --- WGO wrote: > > I need an environment variable from my .profile on > Solaris and having troubles getting at it. I have a Perl > script which executes fine outside of cron and now am trying > to do via cron. I wanted to stay away from a shell script and > was wondering what is the easiest way to get my .profile > loaded, so the Perl script can access the needed variable. > > Rather than try to source your entire profile, why not simply set the > necessary environment variables in the Perl script itself, > using the %ENV > hash? I am in the same boat and after some research, came up with the following: 30 4 * * 0,2-5 . ./.cronwrapper && /usr/bin/perl /d/src/pl600.pl dp11 where .cronwrapper has the definitions of params needed and exports.
In a number of searches, most warned against doing the .profile for security and other reasons. By placing the .cronwrapper in your home directory, you can control and I have it running under boh Solaris and Linux Redhat. If you have any questions and/or problems, please let me know. Thanks. Wags ;) David R. Wagner Senior Programmer Analyst FedEx Freight 1.408.323.4225x2224 TEL 1.408.323.4449 FAX http://fedex.com/us > > See this post perhaps for some other tips (it's Solaris > specific, which may > help): http://www.perlmonks.org/?node_id=624540 > > T > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/