Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 01-10-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,434
CRON doesn't execute your .profile before executing the command.
If your command needs specific environment initialisation (variables, path...) it may work incorrectly.
In that case try that :

Code:

36 10 * * * . ~/.profile ; /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log 2>&1


Jean-Pierre.
Sponsored Links
  #9 (permalink)  
Old 01-10-2007
Registered User
 

Join Date: Dec 2006
Posts: 55
Quote:
Originally Posted by aigles
CRON doesn't execute your .profile before executing the command.
If your command needs specific environment initialisation (variables, path...) it may work incorrectly.
In that case try that :

Code:

36 10 * * * . ~/.profile ; /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log 2>&1


Jean-Pierre.
yea i agree with aigles since if the script depend on environment variable it wont work , so using the above will work
  #10 (permalink)  
Old 01-10-2007
Registered User
 

Join Date: Dec 2006
Posts: 20
Thanks guys! My entry is now working!
  #11 (permalink)  
Old 01-10-2007
Registered User
 

Join Date: Dec 2006
Posts: 20
Quote:
Originally Posted by maheshwin
yea i agree with aigles since if the script depend on environment variable it wont work , so using the above will work
1 more question, what does . ~/.profile ; and 2>&1 do?

Thanks!
  #12 (permalink)  
Old 01-11-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,434
. ~/.profile ;
. Execute file in current environment
~ Home directory of current user.
; command separator

2>&1
File descriptor 2 (stderr) is to be opened for writing as a duplicate of file descriptor 1 (stdout)
The stderr displays are written in the same file as stdout.


Jean-Pierre.
  #13 (permalink)  
Old 01-11-2007
Technorati Master
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 3,006
Quote:
Originally Posted by aigles
CRON doesn't execute your .profile before executing the command.
If your command needs specific environment initialisation (variables, path...) it may work incorrectly.
In that case try that :

Code:

36 10 * * * . ~/.profile ; /bscsprod/bscs/prod/WORK/XREF/teh -t -f MPPROFIL >> /bscsprod/bscs/prod/WORK/XREF/tehcron.log 2>&1


Jean-Pierre.
Adding . $HOME/.profile entry to the cron is not a fair idea
Instead provide the script to be executed via cron the needed environment variables.

With inclusion of .$HOME/.profile all that is not needed by the script is set to the environment.
  #14 (permalink)  
Old 01-11-2007
Registered User
 

Join Date: Dec 2006
Posts: 20
Quote:
Originally Posted by aigles
. ~/.profile ;
. Execute file in current environment
~ Home directory of current user.
; command separator

2>&1
File descriptor 2 (stderr) is to be opened for writing as a duplicate of file descriptor 1 (stdout)
The stderr displays are written in the same file as stdout.


Jean-Pierre.

THANKS!
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cron not working manna UNIX for Dummies Questions & Answers 1 01-10-2008 02:04 PM
Cron job not working dkranes UNIX for Dummies Questions & Answers 5 10-26-2007 12:01 PM
Cron not working? christo16 UNIX for Dummies Questions & Answers 5 03-09-2007 02:55 AM
cron not working DaleCabell UNIX for Dummies Questions & Answers 1 07-28-2006 08:16 PM
CRON - How to tell it's working? jaffy1229 UNIX for Dummies Questions & Answers 7 04-15-2002 01:09 PM



All times are GMT -4. The time now is 01:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0