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

Re: default environment for scripts?



On Mon, Oct 22, 2001 at 11:09:21PM +0200, Tomas Pospisek wrote:
> > > I assume you can define whatever environment variables you really need
> > > inside the init.d scripts that really need them, since they are
> > > usually conffiles.
> 
> Yes, I can do that but:
> 
> 1) it will be gone the next time I upgrade

No.  dpkg will ask you before overwriting them.

> 3) I'll have to do the same thing for every single programm that is called
>    *somewhere* from an non-interactive shell (daemons, children of
>    daemons, shellcalls from daemons, cron, etc.)

/etc/environment will work for everything that uses PAM.

> > The initial environment comes from /etc/init.d/rcS, and is inherited by
> > every init script, and used (unless the init script overwrites some/all
> > variables).
> 
> Unfortunately that's not the case. I can set a variable in
> /etc/init.d/rcS, export it there but I don't see it in a usershell.
> Neither do I see it in a cronjob. (!)

Thats strange.  I never tested it, but it should work.  You of course need
to reboot for it to take effect.  You might be able to just switch to single
user mode, and back to multi user.  You should only really put variables
there that you dont intend to ever change, otherwise you'd turn your machine
into a windows-like system where you have to reboot every time you change a
variable.

I did change the umask in the cron init script on one of my machines, so
that files procuded by scripts in cron jobs are group writeable.

Its kind of strange that debian has taken the approach of giving each user
their own group, but the umask is not set to 002 universaly.  Its given
conflicting values in several places:
/etc/init.d/rcS sets it to 022
/etc/profile sets it to 002
/etc/csh.cshrc:  umask 002
/etc/csh.login:  umask 022

Anyone know if this was intentional, and why?

Thanks,

Norbert

Attachment: pgpPAGAlrQyru.pgp
Description: PGP signature


Reply to: