UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old September 13th, 2004, 04:19 AM
andyb1ack andyb1ack is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 60 andyb1ack User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 14 sec
Reputation Power: 4
It is true that adding code at the start of a script to set the environment can get it to run from cron as it would from the command prompt.

But depending on how this is done, there is a danger that the script may no longer run as intended if the environment is changed and the script is not updated.

It is good practice to have a separate script that sets the environment and to "dot" this script at the start of the scripts to be run from cron, as well as "dotting" it automatically at logon (for the korn shell this would be achieved by adding the command to the end of the .profile in the home directory).

Using this technique will make it more likely that scripts run the same from the command line as they do from cron, and should also reduce the change management overhead.

This method also has the added benefit that multiple accounts can use this same "environment" script to set their environment the same. For example, if there are a few DBAs they could set the DBA environment via:
$ . some_dir/dba.profile

This is a tip of course and, whilst I realise that the thread was solved technically, I hope it helps someone in the long run.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > CRON job won't run


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway