Go Back   The UNIX and Linux Forums > Operating Systems > Solaris


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-02-2011
Registered User
 
Join Date: Dec 2010
Location: Yugoslavia
Posts: 222
Thanks: 34
Thanked 9 Times in 9 Posts
Environment variables and cron

where do you set environment variables for cron jobs?
I have a feeling it would ignore ~/.bashrc ?

thanks.
Sponsored Links
    #2  
Old 08-02-2011
Skrynesaver's Avatar
Grumpy old geek
 
Join Date: Mar 2011
Location: Éire
Posts: 662
Thanks: 19
Thanked 147 Times in 144 Posts
You can have a file that declares and exports them which you source as the first step in your command... there are no guarantees WRT the shell cron runs in.
The Following User Says Thank You to Skrynesaver For This Useful Post:
orange47 (08-02-2011)
Sponsored Links
    #3  
Old 08-02-2011
ygemici ygemici is offline Forum Advisor  
sed_shell@LNU
 
Join Date: Feb 2010
Location: istanbul
Posts: 1,629
Thanks: 1
Thanked 279 Times in 272 Posts
what is your os and bash version? do you have a .bashrc file?
if you want to set enviroments globaly,you can edit /etc/default/cron.
or you can add bash startup scripts to your cron scripts.

Code:
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
if [ -f ~/.bash ]; then
. ~.bash_profile
fi

regardss
ygemici
The Following User Says Thank You to ygemici For This Useful Post:
orange47 (08-02-2011)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Setting environment variables in Cron file shyamu544 Shell Programming and Scripting 4 07-20-2011 04:43 AM
environment variables radhika03 Shell Programming and Scripting 3 01-22-2007 12:58 PM
Setting environment variables within cron jobs!! atheek Solaris 1 10-09-2006 07:26 AM
Cron Environment Smitty McSmith UNIX for Dummies Questions & Answers 8 07-13-2005 06:31 PM
environment variables Esaia Programming 2 02-20-2003 07:19 PM



All times are GMT -4. The time now is 04:41 PM.