On Sat, Jun 16, 2007 at 01:29:50AM +0200, Daniel Dvo??ák wrote:
> -----Original Message-----
> From: Jeremy Chadwick [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, June 16, 2007 1:04 AM
> To: Daniel Dvo??ák
> Cc: 'John Merryweather Cooper'; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: FreeBSD Port: ipfw2dshield-0.5
> 
> > FreeBSD by default sets PATH to what you see in the mail from cron.
> > That is, /usr/local/bin is not include in the list.  This is Normal(tm).
> 
> Yes, I know and so I was surprised when cron showed this:
> 
> X-Cron-Env: <PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin>
> 
> which is not actualy true because this:
> 
> X# setenv
> TERM=cons25
> PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
> MAIL=/var/mail/root

Actually, it is true.  I suppose no one's explained to you the
difference between an interactive shell, a non-interactive shell,
and a login shell.  I guess I'll do that now.

An interactive shell is one which allocates a pty; an easy way to
remember this is "a shell you plan on typing (interactively) in".
A non-interactive shell is a shell where there is no actual pty
associated with the shell.  A login shell is an interactive shell
which is spawned from login(1).

On FreeBSD, root's shell is /bin/csh.  It's recommended you do not
change it.  Regardless, if you spawn an interactive (or login) shell
(examples: logging in on the console, ssh'ing in as root, telnetting in
as root, or logging in as yourself then using su/sudo/su2, etc.)
/bin/csh will read will read /root/.cshrc.  You'll find a "set path" in
that file, which contains /usr/local/bin.

This is why you see /usr/local/bin when you do a "setenv".

The same concept applies to /bin/sh, except /bin/sh reads /etc/profile
and /root/.profile on an interactive shell.  You'll find that PATH is
set inside of /root/.profile.

Now let's talk about cron.  cron, by default, uses a shell of /bin/sh.
All the shells spawned from cron are non-interactive.  Therefore,
/root/.profile does not get read, thus the default PATH is used.

-- 
| Jeremy Chadwick                                    jdc at parodius.com |
| Parodius Networking                           http://www.parodius.com/ |
| UNIX Systems Administrator                      Mountain View, CA, USA |
| Making life hard for others since 1977.                  PGP: 4BD6C0CB |

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to