Paul Rimmer wrote:
> 
> > Add this to /etc/multicron-p:
> >
> > environment () {
> >       {
> >               echo
> >               echo "$(set)"
> >       } | mailadmin "Environment List"
> > }
> >
> > Then, make sure that periodic contains the new function:
> >
> > periodic () {
> >       environment
> >       checkfreespace
> >       pingcheck
> > }
> >
> > Now, wait for cron to act on this -- fortunately, with multicron-p, you
> > won't have to wait long ;>
> 
> OK, I get the env variables with no mention of $HOSTNAME.  I also added a
> printout of "$(whoami)" to see what user the process was running under but
> it returned a blank string.
> 
> > Finally, try the same thing by adding this immediately prior to main():
> >
> > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> >
> > What do you think?

Sorry -- actually, I meant: add the PATH statement immediately prior to
the call to main, which is the last non-blank line in multicron-p.  In
other words, make sure that you have a complete PATH *prior* to
performing any actions in multicron-p.

> As soon as I add the path change:
> 
> <SNIP>
> ############################################################################
> ##
> # Processing Core   It is recommended you don't add functions directly
> # to his file. Keep them external and source them.
> ############################################################################
> ##
> 
> #Test Line follows
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin
> 
> main () {
> 
> prog=`basename $0`
> <SNIP>
> 
> The mailing no longer occurs.  Remove it and I get the emails again but with
> no $HOSTNAME.  Just so I know, what is the relationship between PATH and
> environment variables?  How does adding the above path provide visibility to
> $HOSTNAME?

I had the opposite -- I could not send Email until I added the PATH line
-- probably due to *where* the PATH is inserted (see above).

Regarding the reason for this, it depends on how the cron process
assumes root authority.  Under certain conditions, a process can assume
another uid _without_ any extraneous baggage normally associated with
that user.  In this case, cron assumes root; but, does not login and
source /etc/profile . . .

-- 

Best Regards,

mds
mds resource
888.250.3987

Dare to fix things before they break . . .

Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . .

_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user

Reply via email to