*BSD News Article 59488


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!newsfeed.internetmci.com!howland.reston.ans.net!blackbush.xlink.net!zib-berlin.de!news.tu-chemnitz.de!irz401!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Continued Crontab Problem on 2.0.5
Date: 12 Jan 1996 22:00:33 GMT
Organization: Private BSD site, Dresden
Lines: 25
Message-ID: <4d6lm1$h7c@uriah.heep.sax.de>
References: <dhawkDKM3qJ.IHp@netcom.com> <4cmf93$eli@uriah.heep.sax.de> <dhawkDKx8CF.Ap3@netcom.com>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.3

dhawk@netcom.com (David H) writes:

> To restate the problem: the 'stats' crontab runs a compiled binary
> that does a system call to determine its home directory. It gets
> an answer of '/root' instead of the actual 'stats' home directory.

You mean: to determine its _current_ directory, right?

Determining the home directory would be done with getenv("HOME").

> Shouldn't a program run by the user 'stats' be able to find the
> home directory for stats?

Yup, with getenv().

It might be a bug or misfeature of cron to not chdir() to ${HOME}
before, but neither is documented, so you can't rely on it anyway.  I
would suggest you talking to Paul Vixie, the author of the BSD cron.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)