[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /etc/init.d scripts



On Fri, 16 Apr 1999 10:41:21 +0300 (IDT), Brock Rozen <brozen@torah.org> said:
>
> All scripts must have one of the following two contained in them:
>
> 1) A PATH environment setting that lists all the directories where any
> programs invoked by the script may be found.

I don't think this is a good idea.  Why should the same information be
coded into every single init.d script that we write, particularly since
it is almost always unnecessary?  When the init.d scripts are run by the
system, or by the admin at a shell prompt, they can rely on having a
sane $PATH.

The real problem you're trying to fix is that you don't have a reasonable
path when you run something with rsh.  I agree that that's a problem.
Your proposal tries to deal with the symptom rather than the cause.  If
you fix the real problem then it will benefit this case plus lots of
others.

We've talked about setting up a policy about /etc/environment.  Perhaps
that's how this should be dealt with.  The simple implementation
wouldn't actually fix your problem, though, because you wouldn't want
the sbin directories on the PATH in /etc/environment.  Perhaps we could
say that programs would, after processing /etc/environment, append
/usr/local/sbin, /sbin and /usr/sbin to the $PATH if this is being set
up for root.  Perhaps we should instead specify that after
/etc/environment is processed /etc/environment.root should be processed,
if this is for root.  Perhaps we should specify that /etc/environment
can be written in sh rather than being simple name=value pairs.  Perhaps
there's a better answer.

> 2) All the programs be hard-linked (must contain a full directory setting)

Using full paths for commands is almost always a mistake.  It makes the
script more fragile (commands sometimes move, or are located elsewhere
on a different system) for no reason, plus it prevents the local admin
from overriding a command by putting a different version of it under
/usr/local and putting that first in the $PATH.

PS:  For scripts which do add regular directories to $PATH, they should
at the least always append them, else you have the same problem with not
allowing the local admin to override the system's binaries.

-- 
Roderick Schertler
roderick@argon.org


Reply to: