PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Burstin <mikeb at davox dot com>
Subject: Re: crontab env question
Date: Mar 29 2001 4:24PM

On Wed, Mar 28, 2001 at 08:37:11AM -0500, Cox, Mark wrote:
> Thanks for the advice.  I ended up writing a unix script which set the
> environment and then called the Perl program.  A little clunky but it
> worked.  I am going to try and use the Begin block like you suggested for
> future programs.  

We do something a little easier for a few of our scripts:

45 0 * * * csh -c "source $HOME/.cshrc; unset noclobber; /path/to/script/script.pl" 1>/dev/null 2>&1 


You might want a su if root should not run, or different shell, but
this might be an easier way.

> 
> Thanks for the help
> 
> Mark
> 
> -----Original Message-----
> From: jmcallister@dtint.com [mailto:jmcallister@dtint.com]
> Sent: Tuesday, March 27, 2001 11:38 AM
> To: SybPerl Discussion List
> Subject: Re: crontab env question
> 
> 
> 
> I always include this code in a BEGIN block.
> 
> 
> 
> BEGIN {
>      # If it's not defined, set the SYBASE environment variable to the
>      # sybase user's home or /usr/local/sybase (in that order).
>      #
>      my($home) = (getpwnam('sybase'))[7];
>      $ENV{SYBASE} = $home ? $home : '/usr/local/sybase' unless
> $ENV{SYBASE};
> }
> use Sybase::CTlib;
> 
> 
> 
> There's also a way to compile the CTlib module with a backup value of
> SYBASE hard coded. In other words, the default value if not already defined
> in the environment.
> 
> James McAllister
> Digital Technology Int'l
> 
> 
> 
>  
> 
>                     "Cox, Mark"
> 
>                              To:     SybPerl Discussion
> List                      
>                     Sent by:                   cc:
> 
>                     owner-SYBPERL-L@lis        Subject:     crontab env
> question                                             
>                     t.cren.net
> 
>  
> 
>  
> 
>                     03/27/01 08:07 AM
> 
>                     Please respond to
> 
>                     SYBPERL-L
> 
>  
> 
>  
> 
> 
> 
> 
> 
> 
> 
> Hopefully a simple question but a little off topic:
> 
> CT-Lib runs great from the command line but when I try to run a job using
> crontab I get an error like this:
> 
> Can't load
> '/bifeed/tools/lib/perl5/site_perl/sun4-solaris/auto/Sybase/CTlib/CTlib.so'
> for module Sybase::CTlib: ld.so.1: /bifeed/tools/bin/perl: fatal: libct.so:
> open failed: No such file or directory at
> /bifeed/tools/lib/perl5/sun4-solaris/5.00404/DynaLoader.pm line 166.
> 
>  at /cifeed/perl/read_cfmt_compass.pl line 36
> BEGIN failed--compilation aborted at /cifeed/perl/read_cfmt_compass.pl line
> 36.
> 
> 
> I realize that it is the enviromental variables not getting set but I have
> them set in my .cshc file.  Where do I need to set the variables for
> crontab
> to pick them up or am I force to set them in a script before I run each
> program?
> 
> Thanks for any help
> 
> Mark
> 

-- 
The best way to accelerate a Windows ++  Linux, The Ultimate
box is at 9.8 meters/second squared  ++ Windows Service Pack
			(quotes taken from /.)
A computer without Microsoft is like ice cream without ketchup

Michael Burstin				mikeb@davox.com