Re: [Leaf-user] ping check not working bug resolution

2001-12-30 Thread Robert Williams

Hi all,
On further investigation I found that the PATH of the multicron-p@ 
process was /usr/bin:/bin. By redirecting std error of the mail 
command I found that it was not finding the mail command.

  # m ermsg
/etc/multicron-p: mail: command not found

I then hard coded the mail command as /usr/sbin/mail and the error I got  was:
 # m ermsg
getservbyname: not found
BusyBox v0.60.1 (2001.10.18-21:35+) multi-call binary

Usage: nc [IP] [port]

Error: Unknown response.
  RSET
  0:
Aborting due to connection error
  Killing child processes: 23012 23014

The solution to this bug was to add PATH=$PATH:/usr/sbin to the 
multicron-p file. The end of the file should now look like:

[ ! -f /etc/lrp.conf ] && exit 1
. /etc/lrp.conf
PATH=$PATH:/usr/sbin
main

The mailadmin() fx now works properly. If there is a more elegant 
solution please let me know.
Thanks,
  Robert Williams

>On 12/29/01 at 9:47 PM, Robert Williams <[EMAIL PROTECTED]> wrote:
>
>>  I am using Dachstien 1.0.2 cd and I am having trouble with
>>  the ping check function. If I run multicron-p from the
>>  command line the ping check works and since the address is
>>  bogus (for testing) it sends me an email.
>
>>  Any idea why the mail feature would work from the command
>>  line but not from cron?
>
>The general answer to a question of this type (i.e., why does this
>command work at the command line, but not when run from cron?) is that
>in the environment set during the execution of a script run from cron,
>there are only about SIX environment variables set, and much of the
>environment found in a command line environment is missing.
>
>However, in using standard scripts for Dachstein, this should not be a
>problem - but it occurs often enough that I thought I should mention
>it.
>--
>David Douthitt
>UNIX Systems Administrator
>HP-UX, Unixware, Linux
>[EMAIL PROTECTED]
>
>___
>Leaf-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/leaf-user


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-03 Thread Paul Rimmer

Great find Robert.  Now that my pingcheck is working with your fix I notice
that the script does not fill in the src field.  Here's what I get in the
"alert: Ping Failure!" email:

host: shaw.ca
date: Thu Jan  3 14:50:51 MST 2002
src :

"src : $HOSTNAME" is the culprit /etc/multicron-d, line 132).  It appears
that $HOSTNAME, defined in network.conf is not visible to the multicron-d
script.  I'm sure it's something to do with the last few lines (see below).
Not being up on unix scripting, I've no idea how to "include" another
scripts definitions.

Any ideas?

Cheers.

Paul
Calgary, Alberta, Canada

> The solution to this bug was to add PATH=$PATH:/usr/sbin to the
> multicron-p file. The end of the file should now look like:
>
> [ ! -f /etc/lrp.conf ] && exit 1
> . /etc/lrp.conf
> PATH=$PATH:/usr/sbin
> main
>
> The mailadmin() fx now works properly. If there is a more elegant
> solution please let me know.
> Thanks,
>   Robert Williams


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-03 Thread Robert Williams

Hi Paul,
This is working on my end but here are a couple of things to check. 
The $HOSTNAME variable is exported from /etc/profile so it should be 
accessible to the shell running multicron-p.

export HOSTNAME="$(hostname)"

Check to see what the output of the command hostname is. If it is 
empty then make sure that you have a file /etc/hostname. If it 
doesn't exist then you can create it manually or have network.conf 
create it by setting CONFIG_HOSTNAME=YES under General Settings in 
network.conf.

Hope This helps,
   Robert Williams

>Great find Robert.  Now that my pingcheck is working with your fix I notice
>that the script does not fill in the src field.  Here's what I get in the
>"alert: Ping Failure!" email:
>
>host: shaw.ca
>date: Thu Jan  3 14:50:51 MST 2002
>src :
>
>"src : $HOSTNAME" is the culprit /etc/multicron-d, line 132).  It appears
>that $HOSTNAME, defined in network.conf is not visible to the multicron-d
>script.  I'm sure it's something to do with the last few lines (see below).
>Not being up on unix scripting, I've no idea how to "include" another
>scripts definitions.
>
>Any ideas?
>
>Cheers.
>
>Paul
>Calgary, Alberta, Canada
>
>>  The solution to this bug was to add PATH=$PATH:/usr/sbin to the
>>  multicron-p file. The end of the file should now look like:
>>
>>  [ ! -f /etc/lrp.conf ] && exit 1
>>  . /etc/lrp.conf
>>  PATH=$PATH:/usr/sbin
>>  main
>>
>>  The mailadmin() fx now works properly. If there is a more elegant
>>  solution please let me know.
>>  Thanks,
>>Robert Williams


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-03 Thread Paul Rimmer

Robert, thanks for the help.

"/bin/hostname" reports the correct value when run from the command line.
The parameter is correctly configured automatically by network.conf.  The
hostname file also exists in /etc.

If I run "mail -s $HOSTNAME [EMAIL PROTECTED]  Hi Paul,
> This is working on my end but here are a couple of things to check.
> The $HOSTNAME variable is exported from /etc/profile so it should be
> accessible to the shell running multicron-p.
>
> export HOSTNAME="$(hostname)"
>
> Check to see what the output of the command hostname is. If it is
> empty then make sure that you have a file /etc/hostname. If it
> doesn't exist then you can create it manually or have network.conf
> create it by setting CONFIG_HOSTNAME=YES under General Settings in
> network.conf.
>
> Hope This helps,
>Robert Williams
>
> >Great find Robert.  Now that my pingcheck is working with your
> fix I notice
> >that the script does not fill in the src field.  Here's what I get in the
> >"alert: Ping Failure!" email:
> >
> >host: shaw.ca
> >date: Thu Jan  3 14:50:51 MST 2002
> >src :
> >
> >"src : $HOSTNAME" is the culprit /etc/multicron-d, line 132).  It appears
> >that $HOSTNAME, defined in network.conf is not visible to the multicron-d
> >script.  I'm sure it's something to do with the last few lines
> (see below).
> >Not being up on unix scripting, I've no idea how to "include" another
> >scripts definitions.
> >
> >Any ideas?
> >
> >Cheers.
> >
> >Paul
> >Calgary, Alberta, Canada


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



Re: [Leaf-user] ping check not working bug resolution

2002-01-03 Thread Michael D. Schleif


Paul Rimmer wrote:
> 
> Robert, thanks for the help.
> 
> "/bin/hostname" reports the correct value when run from the command line.
> The parameter is correctly configured automatically by network.conf.  The
> hostname file also exists in /etc.
> 
> If I run "mail -s $HOSTNAME [EMAIL PROTECTED]  command line I get an email with the correct hostname in the subject field.
> 
> However multicron-p still emails me a blank src??  This is with Dachstein CD
> v1.01 booting from a floppy and then CD.  A pretty plain Jane config,
> nothing fancy.  Everything is being run as root (except dnscache) so nothing
> funky with users.
> 
> OK, my workaround is to change the line to:"src : $(hostname)".  That seems
> to work now.  No idea why default $HOSTNAME doesn't?

Clearly, $HOSTNAME is *not* in the environment for whatever user is
executing your cron job.

Does /etc/profile contain this line?

export HOSTNAME="$(hostname)"

At anyrate, this is how $HOSTNAME gets it value under DCD.  I vaguely
remember having problems with multicron-p and one of my working changes
is to include this line immediately prior to the call to main():

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Nevertheless, there is nothing wrong with your use of $(hostname), since
that is the call used to set HOSTNAME to begin with . . .

-- 

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



RE: [Leaf-user] ping check not working bug resolution

2002-01-03 Thread Paul Rimmer

> Clearly, $HOSTNAME is *not* in the environment for whatever user is
> executing your cron job.

cron is a root process (I assume this means multicron-p will be executed as
root?) and I am logged in as root when I successfully use the $HOSTNAME
global from the command line.  If I can succesfully use the $HOSTNAME global
from the command line while logged in as root doesn't that suggest it is a
known value?  Is there a command equivalent to "env" to check all available
environment variables?

> Does /etc/profile contain this line?
>
>   export HOSTNAME="$(hostname)"

Yes it does.

> At anyrate, this is how $HOSTNAME gets it value under DCD.  I vaguely
> remember having problems with multicron-p and one of my working changes
> is to include this line immediately prior to the call to main():
>
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
>
> Nevertheless, there is nothing wrong with your use of $(hostname), since
> that is the call used to set HOSTNAME to begin with . . .

Now that I have it working it's more out of curiosity to know why it isn't
OK the default way.  Who knows, maybe other scripts on my LRP box aren't
working for the same reason.

Maybe it has something to do with what Dave Douthitt mentioned:

"The general answer to a question of this type (i.e., why does this
command work at the command line, but not when run from cron?) is that
in the environment set during the execution of a script run from cron,
there are only about SIX environment variables set, and much of the
environment found in a command line environment is missing.

However, in using standard scripts for Dachstein, this should not be a
problem - but it occurs often enough that I thought I should mention
it."

Any ideas on what should I check to rule this out Dave?

Thanks,
Paul


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



Re: [Leaf-user] ping check not working bug resolution

2002-01-03 Thread Michael D. Schleif


Paul Rimmer wrote:
> 
> > Clearly, $HOSTNAME is *not* in the environment for whatever user is
> > executing your cron job.
> 
> cron is a root process (I assume this means multicron-p will be executed as
> root?) and I am logged in as root when I successfully use the $HOSTNAME
> global from the command line.  If I can succesfully use the $HOSTNAME global
> from the command line while logged in as root doesn't that suggest it is a
> known value?  Is there a command equivalent to "env" to check all available
> environment variables?
> 
> > Does /etc/profile contain this line?
> >
> >   export HOSTNAME="$(hostname)"
> 
> Yes it does.
> 
> > At anyrate, this is how $HOSTNAME gets it value under DCD.  I vaguely
> > remember having problems with multicron-p and one of my working changes
> > is to include this line immediately prior to the call to main():
> >
> > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> >
> > Nevertheless, there is nothing wrong with your use of $(hostname), since
> > that is the call used to set HOSTNAME to begin with . . .
> 
> Now that I have it working it's more out of curiosity to know why it isn't
> OK the default way.  Who knows, maybe other scripts on my LRP box aren't
> working for the same reason.
> 
> Maybe it has something to do with what Dave Douthitt mentioned:

Actually, that is precisely what I said, ``Clearly, $HOSTNAME is *not*
in the environment for whatever user is executing your cron job.'' 
Since the sixth field in /etc/crontab is changeable, I dare not assume
that root is running your multicron-p ;<

> "The general answer to a question of this type (i.e., why does this
> command work at the command line, but not when run from cron?) is that
> in the environment set during the execution of a script run from cron,
> there are only about SIX environment variables set, and much of the
> environment found in a command line environment is missing.
> 
> However, in using standard scripts for Dachstein, this should not be a
> problem - but it occurs often enough that I thought I should mention
> it."
> 
> Any ideas on what should I check to rule this out Dave?

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 ;>

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?

-- 

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



RE: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread Paul Rimmer

> 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?

As soon as I add the path change:



##
# 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`


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?

Thanks,
Paul


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



Re: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread Michael D. Schleif


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:
> 
> 
> 
> ##
> # 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`
> 
> 
> 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



RE: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread Paul Rimmer

Whoops, added missing /bin to path and now email comes through but $HOSTNAME
still returns nothing.

> > 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?
>
> As soon as I add the path change:
>
> 
> ##
> ##
> ##
> # 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`
> 
>
> 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?


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread Jeff Newmiller

On Fri, 4 Jan 2002, Paul Rimmer wrote:

[...]

> #Test Line follows
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin
> 
> main () {
> 
> prog=`basename $0`
> 
> 
> 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?

By providing visibility to programs, including the "hostname" command.  
If the PATH string doesn't point to the location of the program (like
/bin), then constructs like $(hostname) and `hostname` won't work... they
will spit out errors to stderr and output nothing to stdout... leaving an
empty string as a result.

---
Jeff NewmillerThe .   .  Go Live...
DCN:<[EMAIL PROTECTED]>Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...2k
---


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread Robert Williams

>   Is there a command equivalent to "env" to check all available
>environment variables?
>
Hi,
The command printenv will  give you a list of the current environment 
variables. To see what environment the shell running multicron-p has 
add the line echo `printenv` >> /etc/env.out to the multicron-p file 
like this. Note that I am using back-tics and not single quotes.

pingcheck () {
[ "$lrp_PING_HOSTS" = "" ] && return 0
echo `printenv` >> /etc/env.out

The output of printenv will be in the file env.out.

Hope this helps,
Robert Williams

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



Re: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread Matt Schalit

Paul Rimmer wrote:
> 
> Whoops, added missing /bin to path and now email comes through but $HOSTNAME
> still returns nothing.

You can try to figure it out or just code the
thing to work, like this:

LEAFHOSTNAME=`cat /etc/hostname`

and just use that.  If you want to figure
it out, write a few test scripts for cron
to run that determine as much info as possible,
using things like

   set >/tmp/evars 2>&1
   whoami
   etc...

Matt

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



RE: [Leaf-user] ping check not working bug resolution

2002-01-04 Thread David Douthitt

On 1/3/02 at 8:07 PM, Paul Rimmer <[EMAIL PROTECTED]> wrote:

> Is there a command equivalent to "env" to check all
> available environment variables?

env may be available as part of recent busybox versions; I know there
was a patch for it.  Also, ash should give you a report with the 'set'
command:

# set

Hope this helps!

> Any ideas on what should I check to rule this out Dave?

Make sure the path is set correctly.  Many cron jobs will set their
own paths.  If there are any other environment variables you are
counting on, set them - though I'm not sure which ones those would be.

Another way is to hard code the actual locations.  Some programs look
like this:

#!/bin/sh

RM=/bin/rm
GZIP=/usr/bin/gzip

$GZIP xx && $RM 

...and so forth.  I think that setting your own PATH is easier - and
probably also more secure.
--
David Douthitt
UNIX Systems Administrator
HP-UX, Unixware, Linux
[EMAIL PROTECTED]

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



RE: [Leaf-user] ping check not working bug resolution

2002-01-05 Thread Paul Rimmer

> You can try to figure it out or just code the
> thing to work, like this:
>
> LEAFHOSTNAME=`cat /etc/hostname`

I've gone back to just using $(hostname) vs $HOSTNAME.  Works OK, just have
to replace the few occurences in multicron-p.

> and just use that.  If you want to figure
> it out, write a few test scripts for cron
> to run that determine as much info as possible,
> using things like
>
>set >/tmp/evars 2>&1
>whoami
>etc...

I found that whoami returns a null string when run from the multicron-p
process.  $(set) returns the following from the multicron-p process (note
PATH was modded from default by the suggestions from the list):

lrp_SC_MINKB=-1
lrp_SC_MAIL_LEVEL=2
lrp_DATE_SERVER=time.nrc.ca
HOME=/root
lrp_LOGS_DAILY=daemon.log debug kern.log messages syslog user.log   ppp.log
pslave.log
prog=multicron-p
lrp_LOGS_DEPTH=4
SP=
OIFS=

PS1=#
OPTIND=1
lrp_MAIL_SERVER=shawmail.cg.shawcable.net
PS2=>
lrp_SC_MINPER=2
LOGNAME=root
[EMAIL PROTECTED]
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
lrp_LOGS_WEEKLY=auth.log lastlog
lrp_SPACECHECK=NO
lrp_SC_DEL_L1=/var/log/*[4-9].gz
SHELL=/bin/sh
lrp_SC_DEL_L2=/var/log/*[1-3].gz
lrp_SC_DEL_L3=/var/log/*.gz
IFS=

lrp_SC_DEL_L4=/var/log/*.0
lrp_PING_HOSTS=google.com shawcable.tucows.com
lrp_SC_DEL_L5=/var/log/wtmp
PWD=/root
lrp_LOGS_MONTHLY=wtmp
TAB=

It's funny that $HOME shows as /root but whoami doesn't return "root".
Also, all of the lrp.conf environment variables appear to be visible but not
the ones from network.conf (where $HOSTNAME is defined).  Set ran from the
command line as root returns:

SSH_CLIENT=192.168.1.7 1125 22
USER=root
MAIL=/var/spool/mail/root
HOSTNAME=ronin-firewall
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
HOME=/root
SSH_TTY=/dev/ttyp0
PS1=
ronin-firewall: -root-
#
OPTIND=1
PS2=>
LOGNAME=root
_=date
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SHELL=/bin/sh
IFS=

PWD=/root

Does any of this point to why $HOSTNAME isn't visible from multicron-p?

Thanks,
Paul


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-05 Thread Paul Rimmer


> > Is there a command equivalent to "env" to check all
> > available environment variables?
>
> env may be available as part of recent busybox versions; I know there
> was a patch for it.  Also, ash should give you a report with the 'set'
> command:
>
> # set
>
> Hope this helps!

Thanks for the info Dave.  It appears on Dachstein we have "set" and
"printenv".  On my LRP box, when ran from multicron-p set outputs:

set: lrp_SC_MINKB=-1
lrp_SC_MAIL_LEVEL=2
lrp_DATE_SERVER=time.nrc.ca
HOME=/root
lrp_LOGS_DAILY=daemon.log debug kern.log messages syslog user.log   ppp.log
pslave.log
rc=1
prog=multicron-p
lrp_LOGS_DEPTH=4
SP=
OIFS=

PS1=#
OPTIND=1
lrp_MAIL_SERVER=shawmail.cg.shawcable.net
PS2=>
x=18
h=shaw.ca
lrp_SC_MINPER=2
LOGNAME=root
MIN=3
[EMAIL PROTECTED]
MAX=18
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
lrp_LOGS_WEEKLY=auth.log lastlog
lrp_SPACECHECK=NO
lrp_SC_DEL_L1=/var/log/*[4-9].gz
SHELL=/bin/sh
SLEEP=10
lrp_SC_DEL_L2=/var/log/*[1-3].gz
lrp_SC_DEL_L3=/var/log/*.gz
IFS=

lrp_SC_DEL_L4=/var/log/*.0
lrp_PING_HOSTS=google.com shawcable.tucows.com shaw.ca
lrp_SC_DEL_L5=/var/log/wtmp
PWD=/root
lrp_LOGS_MONTHLY=wtmp
TAB=

and printenv dumps:
printenv: HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
SHELL=/bin/sh
PWD=/root

Not sure why printenv dumps a small subset of set's output?  Looks like set
is definitely the more informative command.

Paul


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



Re: [Leaf-user] ping check not working bug resolution

2002-01-05 Thread Michael D. Schleif


Paul Rimmer wrote:
> 

[ snip ]

> It's funny that $HOME shows as /root but whoami doesn't return "root".
> Also, all of the lrp.conf environment variables appear to be visible but not
> the ones from network.conf (where $HOSTNAME is defined).

[ snip ]

As I indicated previously, /etc/profile is where your users' environment
variable $HOSTNAME originates during the login process.  It is only
coincidental that Charles used $HOSTNAME in network.conf.  Notice,
multicron-* never sources /etc/network.conf, which means that it has
*no* idea what is or isn't in that file . . .

-- 

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



RE: [Leaf-user] ping check not working bug resolution

2002-01-05 Thread Paul Rimmer

> As I indicated previously, /etc/profile is where your users' environment
> variable $HOSTNAME originates during the login process.  It is only
> coincidental that Charles used $HOSTNAME in network.conf.  Notice,
> multicron-* never sources /etc/network.conf, which means that it has
> *no* idea what is or isn't in that file . . .

I wonder what user multicron-p runs under since whoami prints nothing when
run by that process?  I'm not familair with the concept of sourcing scripts,
I'll look into that.  Thanks for helping an LRP scripting rookie understand
this stuff.

Sounds like I shouldn't worry about $HOSTNAME not working in multicron-p.
Doesn't mean something fundamental is broken which is what I was trying to
discern with all of my daft questions.

Cheers,
Paul


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



RE: [Leaf-user] ping check not working bug resolution

2002-01-06 Thread Jeff Newmiller

On Sat, 5 Jan 2002, Paul Rimmer wrote:

> > As I indicated previously, /etc/profile is where your users' environment
> > variable $HOSTNAME originates during the login process.  It is only
> > coincidental that Charles used $HOSTNAME in network.conf.  Notice,
> > multicron-* never sources /etc/network.conf, which means that it has
> > *no* idea what is or isn't in that file . . .
> 
> I wonder what user multicron-p runs under since whoami prints nothing when
> run by that process?  

I am pretty sure it runs as root... it runs as a derivative of a process
started during bootup that is not invoked by tinylogin, which is normally
what sets the LOGNAME variable, which is used to set the USER variable in
POSIXness.  (I don't have DS, so some of this may have changed.)

> I'm not familair with the concept of sourcing scripts,
> I'll look into that.  Thanks for helping an LRP scripting rookie understand
> this stuff.

To pretend you typed the contents of /somefile into the shell, use

  source /somefile

or the abbreviation,

  . /somefile

and note the space.

> 
> Sounds like I shouldn't worry about $HOSTNAME not working in multicron-p.
> Doesn't mean something fundamental is broken which is what I was trying to
> discern with all of my daft questions.

Yes.  But learning why multicron-p's environment is different is
worthwhile, too.

---
Jeff NewmillerThe .   .  Go Live...
DCN:<[EMAIL PROTECTED]>Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...2k
---


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



Re: [Leaf-user] ping check not working bug resolution

2002-01-07 Thread Charles Steinkuehler

> It's funny that $HOME shows as /root but whoami doesn't return "root".
> Also, all of the lrp.conf environment variables appear to be visible but
not
> the ones from network.conf (where $HOSTNAME is defined).  Set ran from the
> command line as root returns:

Actually, the network.conf definition of $HOSTNAME is irrelevent in this
context...

Variables from lrp.conf are avaiable because the lrp.conf file is sourced by
multicron, which is how it knows if it should do things like pingcheck in
the first place.

$HOSTNAME is typically set by the shell startup scripts (/etc/profile,
~/.profile, &c).  Programs run from cron do not go through the normal login
process, which is why they have a limited environment.

> Does any of this point to why $HOSTNAME isn't visible from multicron-p?

Because cron scripts don't execute the normal /etc/profile shell startup
stuff.  Instead, cron builds an environment for the program to execute in,
which has a very limited environment.

The problems with $HOSTNAME (and the other problems with pingcheck) aren't
really suprising, but they are bugs, and have been put on the list of things
to fix for the next version...

Charles Steinkuehler
http://lrp.steinkuehler.net
http://c0wz.steinkuehler.net (lrp.c0wz.com mirror)



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



Re: [Leaf-user] ping check not working bug resolution

2002-01-07 Thread Charles Steinkuehler

> > As I indicated previously, /etc/profile is where your users' environment
> > variable $HOSTNAME originates during the login process.  It is only
> > coincidental that Charles used $HOSTNAME in network.conf.  Notice,
> > multicron-* never sources /etc/network.conf, which means that it has
> > *no* idea what is or isn't in that file . . .
>
> I wonder what user multicron-p runs under since whoami prints nothing when
> run by that process?  I'm not familair with the concept of sourcing
scripts,
> I'll look into that.  Thanks for helping an LRP scripting rookie
understand
> this stuff.

That's because whoami is a POSIXness shell-script that simply echos the
value of the $USER environment variable.  Since this isn't setup properly
when being run by cron, you don't get any output :(

> Sounds like I shouldn't worry about $HOSTNAME not working in multicron-p.
> Doesn't mean something fundamental is broken which is what I was trying to
> discern with all of my daft questions.

This is correct...nothing fundamental is broken, and none of the laws of
physics have been altered.  Either the ping-check stuff never worked, or in
updating other parts of the distribution (especially busybox) this
functionality was broken and not noticed until now.

Charles Steinkuehler
http://lrp.steinkuehler.net
http://c0wz.steinkuehler.net (lrp.c0wz.com mirror)



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