Environment variables and cron | Unix Linux Forums | Solaris

  Go Back    


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.

Environment variables and cron

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-02-2011
orange47 orange47 is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 31 October 2014, 3:54 AM EDT
Location: Yugoslavia
Posts: 268
Thanks: 68
Thanked 10 Times in 10 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
Skrynesaver Skrynesaver is offline Forum Advisor  
Grumpy old geek
 
Join Date: Mar 2011
Last Activity: 31 October 2014, 12:36 PM EDT
Location: Éire
Posts: 825
Thanks: 20
Thanked 185 Times in 181 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
Last Activity: 9 October 2014, 9:49 AM EDT
Location: istanbul
Posts: 1,672
Thanks: 2
Thanked 287 Times in 279 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 02:33 PM.