rc.d and environment variables

Polytropon freebsd at edvax.de
Fri Dec 24 03:17:39 UTC 2010


On Fri, 24 Dec 2010 09:07:35 +0600, Victor Sudakov <vas at mpeks.tomsk.su> wrote:
> I have tried putting "setenv KRB5_KTNAME /home/svn/svn.keytab" in
> ~svn/.cshrc, it does not help. Evidently the svn user's login shell is
> not called when "/usr/local/etc/rc.d/svnserve start" is called.

I did already assume something like that. This mechanism
relies on some kind of login that causes the shell to be
run (usually an interactive shell), which isn't the case
here.



> Excuse me? What does /etc/rc.local have to do with the rc.subr
> framework? 

Nothing. The /etc/rc.local script is executed along with
the system startup. It is considered obsolete (I think),
but it should work, and therefore be able to set a system-wide
environment variable. This script is not in any relation
with the rc.subr framework.



> Of course I can abandon the standard /usr/local/etc/rc.d/svnserve
> script and write my own one, or start svnserve from /etc/rc.local
> (which I will do if I don't find a more graceful way), but it is not
> what the question was about. 

Yes, I fully understand: You need to set an environmental
variable that will be picked up later on by the svnserve
program (in some way, not neccessarily by accessing a file).
That's why I think

	KRB5_KTNAME=/home/svn/svn.keytab; export KRB5_KTNAME

in /etc/rc.local should create the $KRB5_KTNAME environment
variable at system startup.

Anyway, did you find a way to use some _flags= setting for
/etc/rc.conf to be used by svnserve? This would be the
method most other programs handle things like configuration
flags that are not set by an own config file.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list