Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

Why won't crontab jobs pick up my environment variables?

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
TrogL Donating Member (1000+ posts) Send PM | Profile | Ignore Sat Apr-24-04 01:28 AM
Original message
Why won't crontab jobs pick up my environment variables?
I figure it's because they're in .profile and crontab uses sh.

How do I talk it into using ksh? Where do I set my environment variables?
Printer Friendly | Permalink |  | Top
The Traveler Donating Member (1000+ posts) Send PM | Profile | Ignore Sat Apr-24-04 01:31 AM
Response to Original message
1. Dammit ... let me know if you get an answer to that one!
Always wound up having to wrap things in scripts that set the environment variables. Tedious.
Printer Friendly | Permalink |  | Top
 
necso Donating Member (1000+ posts) Send PM | Profile | Ignore Sat Apr-24-04 03:57 AM
Response to Original message
2. SHELL
is pretty much a standard crontab environment variable. (Also standard are USER --or the same thing in another form-- and HOME).

You should be able to set environment variables directly in the crontab itself, but try it and see if it works.

I typically keep a bunch of script templates handy and customize them for any need. I actually like to be able to change cron operation without changing the crontab, so I use scripts for everything. But this is a matter of taste.

http://www.linux-mag.com/2003-02/power_03.html has a few examples and a brief discussion.

Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Wed May 01st 2024, 06:13 PM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC