Re: dhclient-exit-hooks

2006-05-04 Thread Daniel Bye
(Apologies for the rather fragmentary nature of this post - I've been
typing and reading  the scripts and man pages, trying to get my head round
what's going on...)

On Wed, May 03, 2006 at 05:43:48PM -0400, fbsd wrote:
 I figured the Shared object not found error is another sign
 of what is wrong in general so I commented out the mail command
 to concentrate on just the logger problem. 

Fair enough - we'll come back to this later!

 During testing the
 logger problem I determined the script if statement is not
 working.

It ought to - the test is structured correctly, so I can't see any
reason it would not behave in any way other than you would expect.

 Problem seems more like bug in how and or when during the boot
 process the script is getting executed.

Yeah, it's beginning to look like it, isn't it?  Did you try running it
with xtrace turned on?  Perhaps you could even try running rc under
xtrace?  (I have done this in the past, it spews forth a great deal of
noise, but among the noise you may find what you are looking for.)

 This has nothing to do with my script code.
 This is how FreeBSD is handling the default dhclient-script that
 comes pre installed on the system.
 
 The recorder directives have made no difference.

Yep, that makes sense - now I understand where your code is being called
from.

 Please note I am not using the isc-dhcp port dhclient.
 I am running the dhclient that comes as part of the base
 install of FreeBSD.

Noted.

 I have ifconfig_dc0=DHCP in rc.conf to launch
 /sbin/dhclient-script.
 dhclient-script calls dhclient-exit-hooks

 I don't think the recorder directives get into play because
 dhclient does not use the rc.d environment.

No, not the ones you added to the dhclient-exit-hooks, but dhclient is
started by this block of code in /etc/network.subr:

if dhcpif $1; then
if [ $_cfg -ne 0 ] ; then
ifconfig $1 up
fi
/etc/rc.d/dhclient start $1
_cfg=0
fi

(dhcpif() tests the value of $1, returning true if it is DHCP or dhcp or
any combination in mixed case)

/etc/network.subr gets called from /etc/rc.d/netif (among others, but it
is netif that is called earliest, I believe).

/etc/rc.d/dhclient does use rcorder, although you are right in that
/sbin/dhclient doesn't know anything about it.

As far as I can tell, the sequence of events is something like this:

rc builds a list of files to run, using rcorder(8)

These scripts run, occasionally calling in other helper scripts (such as
/etc/network.subr).

When netif is called, it calls network.subr, which calls
/etc/rc.d/dhclient as necessary.

/etc/rc.d/dhclient starts /sbin/dhclient, which in turn calls
/sbin/dhclient-script at various points in its execution.

/sbin/dhclient-script then calls the enter and exit hooks at the
appropriate times.


 I know the dhclient-exit-hooks script is executing because of the
 echo commands I put in it before and after the IF statement.

Yep, that's fair comment.

 I also know the dhclient variables are being loaded in the
 /etc/dhcpd.name-servers file because I empty it before rebooting
 system, and after words I edit it and it contains the correct
 values.

Which suggests that your code is indeed Doing the Right Thing.

 I am beginning to think that something changed between 4.x and 6.0
 in
 the way the dhclient-script get processed during boot.
 It's acting like it gets executed to early in the boot process.
 Do I have enough evidence on this to submit a bug report???

I reckon it's worth trying under xtrace to see if that provides any clue.

You could also try adding -s to the logger call, so it prints its
messages to STDERR as well as to the nominated log file.

Dan

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgpcKvJGJmCSp.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-04 Thread fbsd
Today I installed the isc-dhcp-client package.
It installs a completlly different dhclient-script.
One that looks like it matchhes what your begin/exit
scripts are designed to work with.


# base version
/etc/dhclient-exit-hooks
/etc/dhclient-exit-hooks.sav
/etc/dhclient.conf
/sbin/dhclient
/sbin/dhclient-script

# port version
/etc/rc.d/dhclient
/usr/local/etc/dhclient.conf
/usr/local/etc/dhclient.conf.sample
/usr/local/sbin/dhclient
/usr/local/sbin/dhclient-script

At the end of the pkg install it says this.
  To setup dhclient, you may need to edit /etc/rc.conf to
replace the
  base system dhclient, such as :

   dhcp_program=/usr/local/sbin/dhclient
   dhcp_flags=-q



When I boot with this in my rc.conf

dhcp_program=/usr/local/sbin/dhclient
dhcp_flags=-q# no banner
background_dhclient=YES  # Start dhcp client in the
background.
ifconfig_dc0=DHCP

I get these error messages over and over.
Have to reboot in single user mode to edit rc.conf to fix.

 Can't bind to dhcp address: Address already in use
 Please make sure there is no other dhcp server
 running and that there's no entry for dhcp or
 bootp in /etc/inetd.conf.   Also make sure you
 are not running HP JetAdmin software, which
 includes a bootp server.


When I boot with the same rc.conf content execpt with
#ifconfig_dc0=DHCP commented out, I do not get ip address from
dhcp server.

Next run I edited the pkg version of /usr/local/etc/dhclient.conf
and added 'interface dc0' to it and rebooted and got same results.


I think this is another indicator of a bug with the base dhclient
and
that this bug makes the pkg version unusable.

How do I turn on this xtrace you talk about to capture the rc.conf
boot process?
I can not find man xtrace. There is a ktrace.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-04 Thread Daniel Bye
On Thu, May 04, 2006 at 10:41:05AM -0400, fbsd wrote:
 Today I installed the isc-dhcp-client package.

'K.  Hope you have better luck.  I have never used it, so don't know
anything about it.



 I think this is another indicator of a bug with the base dhclient
 and
 that this bug makes the pkg version unusable.

Yep, it certainly seems that something funky is going on.

 How do I turn on this xtrace you talk about to capture the rc.conf
 boot process?
 I can not find man xtrace. There is a ktrace.

No, it's a shell feature.  You enable it by editing your shebang, so it
looks like this:

#!/bin/sh -x

Or for interactive use, you can run it like this:

 # sh -x /path/to/your/script

Sorry dude, I am now completely out of ideas.

I hope you get it sorted.

Dan

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgpuedjx4x2cq.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
I changed #! /bin/sh  to #!/bin/sh   it had no effect.
Logger command still not producing output.

using sendmail to construct the email made no difference.
Still get this message

/libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
required by send-mail

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Norbert
Papke
Sent: Tuesday, May 02, 2006 9:47 PM
To: [EMAIL PROTECTED]
Cc: freebsd-questions@freebsd.org
Subject: Re: dhclient-exit-hooks


On Tuesday 02 May 2006 06:12, fbsd wrote:
 IF I execute the cat command to issue the notification email
 from the command line it works fine, but when used in the
 script I get these messages during boot process.
 I am running postfix launched by the sendmail wrappers
 on a FreeBSD 6.0 system.

 ~/.mailrc: No match.

Use sendmail(8) rather than mail(1).  mail(1) expects to be run from
a user
session and looks for the user's preferences stored in the user's
,mailrc
file.  No user is available during the boot process.

In your script,

 #! /bin/sh

Also, try removing the space between #! and /bin/sh.  It may be
causing
some weirdness.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
[EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-03 Thread Daniel Bye
On Wed, May 03, 2006 at 08:07:39AM -0400, fbsd wrote:
 I changed #! /bin/sh  to #!/bin/sh   it had no effect.
 Logger command still not producing output.
 
 using sendmail to construct the email made no difference.
 Still get this message
 
 /libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
 required by send-mail

Try putting something like this in your script file:

# PROVIDE: your_script_service
# REQUIRE: SERVERS

If my understanding is correct, this should ensure that your script will
not be called until after the dummy dependency SERVERS is run, which
requires that ldconfig has already run.

Note: not tested, not even sure it'll work, but it can't hurt to try.

In any event, rcorder(8) might help.

Dan

 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Norbert
 Papke
 Sent: Tuesday, May 02, 2006 9:47 PM
 To: [EMAIL PROTECTED]
 Cc: freebsd-questions@freebsd.org
 Subject: Re: dhclient-exit-hooks
 
 
 On Tuesday 02 May 2006 06:12, fbsd wrote:
  IF I execute the cat command to issue the notification email
  from the command line it works fine, but when used in the
  script I get these messages during boot process.
  I am running postfix launched by the sendmail wrappers
  on a FreeBSD 6.0 system.
 
  ~/.mailrc: No match.
 
 Use sendmail(8) rather than mail(1).  mail(1) expects to be run from
 a user
 session and looks for the user's preferences stored in the user's
 ,mailrc
 file.  No user is available during the boot process.
 
 In your script,
 
  #! /bin/sh
 
 Also, try removing the space between #! and /bin/sh.  It may be
 causing
 some weirdness.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 [EMAIL PROTECTED]
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgpg8lWu8kCaE.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
What goes in your_script_service?
Is it suppose to be script name dhclient-exit-hooks?
Is the # comment char to be removed?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Daniel Bye
Sent: Wednesday, May 03, 2006 11:42 AM
To: freebsd-questions@freebsd.org
Subject: Re: dhclient-exit-hooks


On Wed, May 03, 2006 at 08:07:39AM -0400, fbsd wrote:
 I changed #! /bin/sh  to #!/bin/sh   it had no effect.
 Logger command still not producing output.

 using sendmail to construct the email made no difference.
 Still get this message

 /libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
 required by send-mail

Try putting something like this in your script file:

# PROVIDE: your_script_service
# REQUIRE: SERVERS

If my understanding is correct, this should ensure that your script
will
not be called until after the dummy dependency SERVERS is run, which
requires that ldconfig has already run.

Note: not tested, not even sure it'll work, but it can't hurt to
try.

In any event, rcorder(8) might help.

Dan


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Norbert
 Papke
 Sent: Tuesday, May 02, 2006 9:47 PM
 To: [EMAIL PROTECTED]
 Cc: freebsd-questions@freebsd.org
 Subject: Re: dhclient-exit-hooks


 On Tuesday 02 May 2006 06:12, fbsd wrote:
  IF I execute the cat command to issue the notification email
  from the command line it works fine, but when used in the
  script I get these messages during boot process.
  I am running postfix launched by the sendmail wrappers
  on a FreeBSD 6.0 system.
 
  ~/.mailrc: No match.

 Use sendmail(8) rather than mail(1).  mail(1) expects to be run
from
 a user
 session and looks for the user's preferences stored in the user's
 ,mailrc
 file.  No user is available during the boot process.

 In your script,

  #! /bin/sh

 Also, try removing the space between #! and /bin/sh.  It may
be
 causing
 some weirdness.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 [EMAIL PROTECTED]

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
[EMAIL PROTECTED]


--
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622
166A

_
  ASCII ribbon campaign
( )
 - against HTML, vCards and
X
- proprietary attachments in e-mail
/ \

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-03 Thread Daniel Bye
On Wed, May 03, 2006 at 12:17:00PM -0400, fbsd wrote:
 What goes in your_script_service?
 Is it suppose to be script name dhclient-exit-hooks?

Yes.  Sorry, hadn't been paying due attention, otherwise I
would have put 'dhclient-exit-hooks'  ;-)

 Is the # comment char to be removed?

No - leave them in.  Take a look at some of the scripts in /etc/rc.d/
and /usr/local/etc/rc.d/

Dan

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgpkgbwkztiiG.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
Added this and still no joy.

# PROVIDE: 'dhclient-exit-hooks'
# REQUIRE: SERVERS

As a side bar. This problem started in 6.0 I think.
I only ran 5.4 for short time before going to 6.0
But I do know I did not have this problem in 3.x and 4.x versions.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Daniel Bye
Sent: Wednesday, May 03, 2006 12:22 PM
To: Daniel Bye; freebsd-questions@freebsd.org
Subject: Re: dhclient-exit-hooks


On Wed, May 03, 2006 at 12:17:00PM -0400, fbsd wrote:
 What goes in your_script_service?
 Is it suppose to be script name dhclient-exit-hooks?

Yes.  Sorry, hadn't been paying due attention, otherwise I
would have put 'dhclient-exit-hooks'  ;-)

 Is the # comment char to be removed?

No - leave them in.  Take a look at some of the scripts in
/etc/rc.d/
and /usr/local/etc/rc.d/

Dan

--
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622
166A

_
  ASCII ribbon campaign
( )
 - against HTML, vCards and
X
- proprietary attachments in e-mail
/ \

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-03 Thread Atom Powers

On 5/3/06, fbsd [EMAIL PROTECTED] wrote:

I changed #! /bin/sh  to #!/bin/sh   it had no effect.
Logger command still not producing output.

using sendmail to construct the email made no difference.
Still get this message

/libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
required by send-mail



Did you rebuild the package?
I have had a similar problem with, in my case, net-snmp. Reinstalling
the port fixed it.
Something about statically linked libraries I think.


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-03 Thread Daniel Bye
On Wed, May 03, 2006 at 12:52:07PM -0400, fbsd wrote:
 Added this and still no joy.
 
 # PROVIDE: 'dhclient-exit-hooks'
 # REQUIRE: SERVERS

I'm sure it won't fix the problem, but you shouldn't include the quotes
around the term for # PROVIDE:.

Also, I think the rcorder block needs a blank line before and after it
to be parsed properly by rcorder at startup.

 As a side bar. This problem started in 6.0 I think.
 I only ran 5.4 for short time before going to 6.0
 But I do know I did not have this problem in 3.x and 4.x versions.

If these suggestions don't help, I'm afraid I'm out of ideas, sorry.

Dan

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgplzQ5ZtQpNf.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
There is nothing to rebuild.
I am using the built in dhclient that comes with the system.

-Original Message-
From: Atom Powers [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 03, 2006 1:05 PM
To: [EMAIL PROTECTED]
Cc: Norbert Papke; freebsd-questions@freebsd.org
Subject: Re: dhclient-exit-hooks


On 5/3/06, fbsd [EMAIL PROTECTED] wrote:
 I changed #! /bin/sh  to #!/bin/sh   it had no effect.
 Logger command still not producing output.

 using sendmail to construct the email made no difference.
 Still get this message

 /libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
 required by send-mail


Did you rebuild the package?
I have had a similar problem with, in my case, net-snmp.
Reinstalling
the port fixed it.
Something about statically linked libraries I think.


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-03 Thread Daniel Bye
On Wed, May 03, 2006 at 02:25:08PM -0400, fbsd wrote:
 There is nothing to rebuild.
 I am using the built in dhclient that comes with the system.

But it's not dhclient that's emitting the error, is it?  It's your MTA.
(check in /etc/mail/mailer.conf, and you will see that send-mail is
an alias for the binary of your MTA)

Atom's suggestion is worth pursuing.

Dan

 
 -Original Message-
 From: Atom Powers [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 03, 2006 1:05 PM
 To: [EMAIL PROTECTED]
 Cc: Norbert Papke; freebsd-questions@freebsd.org
 Subject: Re: dhclient-exit-hooks
 
 
 On 5/3/06, fbsd [EMAIL PROTECTED] wrote:
  I changed #! /bin/sh  to #!/bin/sh   it had no effect.
  Logger command still not producing output.
 
  using sendmail to construct the email made no difference.
  Still get this message
 
  /libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
  required by send-mail
 
 
 Did you rebuild the package?
 I have had a similar problem with, in my case, net-snmp.
 Reinstalling
 the port fixed it.
 Something about statically linked libraries I think.
 
 
 --
 --
 Perfection is just a word I use occasionally with mustard.
 --Atom Powers--
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgpOzKIawEEOF.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
I do not see why postfix would have any thing to do with logger not
working.

I added some ehco statments to test if the if statment is working.
In this pass /etc/dhcpd.name-servers.tmp = /etc/dhcpd.name-servers
so the second echo should not have been executed, but it was

From testing it looks like only the dhcpc variables plus mv,
and echo commands work in the script.

from the boot log
dc0: link state changed to DOWN
dc0: no link dc0: link state changed to UP
 got link
dc0: link state changed to DOWN
 before if check
 after if check
DHCPREQUEST on dc0 to 255.255.255.255 port 67
dc0: link state changed to UP
DHCPACK from 10.0.10.2
dc0: link state changed to DOWN
bound to 10.0.10.4 -- renewal in 43200 seconds.


and here is the dhclient-exit-hooks script

#!/bin/sh

# PROVIDE: dhclient-exit-hooks
# REQUIRE: SERVERS

###  Start of refresh dhcpd dns ip  
# This script will propagate to dhcpd the changed dns servers ip
address
# which dhcp-client puts in resolv.conf.
#
# In dhcpd.conf replace the option domain-name-servers line with
this
#
#  include /etc/dhcpd.name-servers;
#
# Spript uses the dhcpc variables to build temp line in dhcpd
format.
# Then compare temp content to production content.
# If different replace production content with new content from
temp,
# and restart dhcp to reread dhcpd.conf containing new ISP dns ip
addresses.
#
# logging event and sending email to user root is optional.
#
# Note: All LAN machines using dhcpd will not get new ISP dns ip
addresses
# until they reboot or their lease comes up for renewal.
#
# Each of the following lines must be one long line. IE: no wrap
arounds



# load my_domain_name_servers variable with ISP dns ip addresses
from dhcpc
my_domain_name_servers=`echo $new_domain_name_servers | sed -e 's/
/, /g'`

# Create single line in file to be included in dhcpd.conf
echo option domain-name-servers $my_domain_name_servers ; 
/etc/dhcpd.name-servers.tmp

echo  before if check

# See if different from what production file contains
cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
if [ $? -gt 0 ]; then
echo  after if check
  # move the new file into place
  mv /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
  # restart dhcp using whatever is appropriate for your platform
  #service dhcpd restart
  #/usr/local/etc/rc.d/isc-dhcpd.sh restart -q
  # Write message to /var/log/dhcpc.log to document event.
  /usr/bin/logger -p user.warning -t dhclient Your ISP DNS IP
addresses changed.
  # Write message to /var/log/dhcpd.log to document event.
  /usr/bin/logger -p local1.warning -t dhclient Your ISP DNS IP
addresses changed.
  fi
#rm -f /etc/dhcpd.name-servers.tmp
###  End of refresh dhcpd dns ip script
###


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Daniel Bye
Sent: Wednesday, May 03, 2006 2:35 PM
To: freebsd-questions@freebsd.org
Subject: Re: dhclient-exit-hooks


On Wed, May 03, 2006 at 02:25:08PM -0400, fbsd wrote:
 There is nothing to rebuild.
 I am using the built in dhclient that comes with the system.

But it's not dhclient that's emitting the error, is it?  It's your
MTA.
(check in /etc/mail/mailer.conf, and you will see that send-mail is
an alias for the binary of your MTA)

Atom's suggestion is worth pursuing.

Dan


 -Original Message-
 From: Atom Powers [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 03, 2006 1:05 PM
 To: [EMAIL PROTECTED]
 Cc: Norbert Papke; freebsd-questions@freebsd.org
 Subject: Re: dhclient-exit-hooks


 On 5/3/06, fbsd [EMAIL PROTECTED] wrote:
  I changed #! /bin/sh  to #!/bin/sh   it had no effect.
  Logger command still not producing output.
 
  using sendmail to construct the email made no difference.
  Still get this message
 
  /libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
  required by send-mail
 

 Did you rebuild the package?
 I have had a similar problem with, in my case, net-snmp.
 Reinstalling
 the port fixed it.
 Something about statically linked libraries I think.


 --
 --
 Perfection is just a word I use occasionally with mustard.
 --Atom Powers--

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
[EMAIL PROTECTED]


--
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622
166A

_
  ASCII ribbon campaign
( )
 - against HTML, vCards and
X
- proprietary attachments in e-mail
/ \

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-03 Thread Daniel Bye
On Wed, May 03, 2006 at 03:35:13PM -0400, fbsd wrote:
 I do not see why postfix would have any thing to do with logger not
 working.

ACK.  I've been talking about the Shared object not found error, which
is definitely, from the error message you posted, caused by postfix not
being able to find pcre.  Has that problem gone away with the addition
of the rcorder directives?  (I've made the assumption here that your
script is being called by rc, from one of your rc.d directories - if
this is NOT the case, then you can pretty well ignore all I've said, and
I apologise for being off the mark...)

 I added some ehco statments to test if the if statment is working.
 In this pass /etc/dhcpd.name-servers.tmp = /etc/dhcpd.name-servers
 so the second echo should not have been executed, but it was

Have you run the script with xtrace turned on?  That at least will show
you which lines of the script are being run.  It might help you narrow
down on the part that goes wrong.  I really can't see anything wrong
with the logic or syntax of your script, so this part of it is somewhat
baffling to me.

 From testing it looks like only the dhcpc variables plus mv,
 and echo commands work in the script.
 
 from the boot log
 dc0: link state changed to DOWN
 dc0: no link dc0: link state changed to UP
  got link
 dc0: link state changed to DOWN
  before if check
  after if check
 DHCPREQUEST on dc0 to 255.255.255.255 port 67
 dc0: link state changed to UP
 DHCPACK from 10.0.10.2
 dc0: link state changed to DOWN
 bound to 10.0.10.4 -- renewal in 43200 seconds.
 
 
 and here is the dhclient-exit-hooks script
 
 #!/bin/sh
 
 # PROVIDE: dhclient-exit-hooks
 # REQUIRE: SERVERS
 
 ###  Start of refresh dhcpd dns ip  
 # This script will propagate to dhcpd the changed dns servers ip
 address
 # which dhcp-client puts in resolv.conf.
 #
 # In dhcpd.conf replace the option domain-name-servers line with
 this
 #
 #  include /etc/dhcpd.name-servers;
 #
 # Spript uses the dhcpc variables to build temp line in dhcpd
 format.
 # Then compare temp content to production content.
 # If different replace production content with new content from
 temp,
 # and restart dhcp to reread dhcpd.conf containing new ISP dns ip
 addresses.
 #
 # logging event and sending email to user root is optional.
 #
 # Note: All LAN machines using dhcpd will not get new ISP dns ip
 addresses
 # until they reboot or their lease comes up for renewal.
 #
 # Each of the following lines must be one long line. IE: no wrap
 arounds
 
 
 
 # load my_domain_name_servers variable with ISP dns ip addresses
 from dhcpc
 my_domain_name_servers=`echo $new_domain_name_servers | sed -e 's/
 /, /g'`
 
 # Create single line in file to be included in dhcpd.conf
 echo option domain-name-servers $my_domain_name_servers ; 
 /etc/dhcpd.name-servers.tmp
 
 echo  before if check
 
 # See if different from what production file contains
 cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
 if [ $? -gt 0 ]; then
 echo  after if check
   # move the new file into place
   mv /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
   # restart dhcp using whatever is appropriate for your platform
   #service dhcpd restart
   #/usr/local/etc/rc.d/isc-dhcpd.sh restart -q
   # Write message to /var/log/dhcpc.log to document event.
   /usr/bin/logger -p user.warning -t dhclient Your ISP DNS IP
 addresses changed.
   # Write message to /var/log/dhcpd.log to document event.
   /usr/bin/logger -p local1.warning -t dhclient Your ISP DNS IP
 addresses changed.
   fi
 #rm -f /etc/dhcpd.name-servers.tmp
 ###  End of refresh dhcpd dns ip script
 ###

[---snip---]

   using sendmail to construct the email made no difference.
   Still get this message
  
   /libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
   required by send-mail

Has this gone away? --^

Apologies for the crossed wires.

Dan

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: D349 B109 0EB8 2554 4D75  B79A 8B17 F97C 1622 166A
 _
  ASCII ribbon campaign ( )
 - against HTML, vCards and  X
- proprietary attachments in e-mail / \


pgp5P3b2BRhsM.pgp
Description: PGP signature


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
I figured the Shared object not found error is another sign
of what is wrong in general so I commented out the mail command
to concentrate on just the logger problem. During testing the
logger problem I determined the script if statement is not
working.
Problem seems more like bug in how and or when during the boot
process the script is getting executed.
This has nothing to do with my script code.
This is how FreeBSD is handling the default dhclient-script that
comes pre installed on the system.

The recorder directives have made no difference.

Please note I am not using the isc-dhcp port dhclient.
I am running the dhclient that comes as part of the base
install of FreeBSD.
I have ifconfig_dc0=DHCP in rc.conf to launch
/sbin/dhclient-script.
dhclient-script calls dhclient-exit-hooks

I don't think the recorder directives get into play because
dhclient does not use the rc.d environment.

I know the dhclient-exit-hooks script is executing because of the
echo commands I put in it before and after the IF statement.

I also know the dhclient variables are being loaded in the
/etc/dhcpd.name-servers file because I empty it before rebooting
system, and after words I edit it and it contains the correct
values.

I am beginning to think that something changed between 4.x and 6.0
in
the way the dhclient-script get processed during boot.
It's acting like it gets executed to early in the boot process.
Do I have enough evidence on this to submit a bug report???


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Daniel Bye
Sent: Wednesday, May 03, 2006 4:42 PM
To: Daniel Bye; freebsd-questions@freebsd.org
Subject: Re: dhclient-exit-hooks


On Wed, May 03, 2006 at 03:35:13PM -0400, fbsd wrote:
 I do not see why postfix would have any thing to do with logger
not
 working.

ACK.  I've been talking about the Shared object not found error,
which
is definitely, from the error message you posted, caused by postfix
not
being able to find pcre.  Has that problem gone away with the
addition
of the rcorder directives?  (I've made the assumption here that your
script is being called by rc, from one of your rc.d directories - if
this is NOT the case, then you can pretty well ignore all I've said,
and
I apologise for being off the mark...)

 I added some ehco statments to test if the if statment is
working.
 In this pass /etc/dhcpd.name-servers.tmp = /etc/dhcpd.name-servers
 so the second echo should not have been executed, but it was

Have you run the script with xtrace turned on?  That at least will
show
you which lines of the script are being run.  It might help you
narrow
down on the part that goes wrong.  I really can't see anything wrong
with the logic or syntax of your script, so this part of it is
somewhat
baffling to me.

 From testing it looks like only the dhcpc variables plus mv,
 and echo commands work in the script.

 from the boot log
 dc0: link state changed to DOWN
 dc0: no link dc0: link state changed to UP
  got link
 dc0: link state changed to DOWN
  before if check
  after if check
 DHCPREQUEST on dc0 to 255.255.255.255 port 67
 dc0: link state changed to UP
 DHCPACK from 10.0.10.2
 dc0: link state changed to DOWN
 bound to 10.0.10.4 -- renewal in 43200 seconds.


 and here is the dhclient-exit-hooks script

 #!/bin/sh

 # PROVIDE: dhclient-exit-hooks
 # REQUIRE: SERVERS

 ###  Start of refresh dhcpd dns ip

 # This script will propagate to dhcpd the changed dns servers ip
 address
 # which dhcp-client puts in resolv.conf.
 #
 # In dhcpd.conf replace the option domain-name-servers line with
 this
 #
 #  include /etc/dhcpd.name-servers;
 #
 # Spript uses the dhcpc variables to build temp line in dhcpd
 format.
 # Then compare temp content to production content.
 # If different replace production content with new content from
 temp,
 # and restart dhcp to reread dhcpd.conf containing new ISP dns ip
 addresses.
 #
 # logging event and sending email to user root is optional.
 #
 # Note: All LAN machines using dhcpd will not get new ISP dns ip
 addresses
 # until they reboot or their lease comes up for renewal.
 #
 # Each of the following lines must be one long line. IE: no wrap
 arounds


 

 # load my_domain_name_servers variable with ISP dns ip addresses
 from dhcpc
 my_domain_name_servers=`echo $new_domain_name_servers | sed -e 's/
 /, /g'`

 # Create single line in file to be included in dhcpd.conf
 echo option domain-name-servers $my_domain_name_servers ; 
 /etc/dhcpd.name-servers.tmp

 echo  before if check

 # See if different from what production file contains
 cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
 if [ $? -gt 0 ]; then
 echo  after if check
   # move the new file into place
   mv /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
   # restart dhcp using whatever is appropriate for your platform
   #service dhcpd restart
   #/usr/local/etc

Re: dhclient-exit-hooks

2006-05-03 Thread Duane Whitty

fbsd wrote:

When this script runs the logger statements do not create any
message in the targeted log files.
IF I execute the same logger statements from the command
line they work as expected.

Hi,

Forgive my ignorance if it turns out I'm totally off track here
but do you need a line in /etc/syslog.conf such as:

!name-of-your-script
*.* /var/log/dhcpd.log
^^^
or whatever level of logging you want


I couldn't get named to log so to /etc/syslog.conf I added

!named
*.*/var/log/named.log

and manually created /var/log/named.log

to have messages of all levels logged.

Just a shot in the dark...

Best Regards,

Duane Whitty
--
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: dhclient-exit-hooks

2006-05-03 Thread fbsd
You missed this statement I posted
 IF I execute the same logger statements from the command
 line they work as expected.

That only could happen if the log files 
were all ready in syslog.conf.

Good try.
You have good grasp of how logging works.

-Original Message-
From: Duane Whitty [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 03, 2006 6:50 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED] ORG
Subject: Re: dhclient-exit-hooks


fbsd wrote:
 When this script runs the logger statements do not create any
 message in the targeted log files.
 IF I execute the same logger statements from the command
 line they work as expected.
Hi,

Forgive my ignorance if it turns out I'm totally off track here
but do you need a line in /etc/syslog.conf such as:

!name-of-your-script
*.* /var/log/dhcpd.log
^^^
or whatever level of logging you want


I couldn't get named to log so to /etc/syslog.conf I added

!named
*.*/var/log/named.log

and manually created /var/log/named.log

to have messages of all levels logged.

Just a shot in the dark...

Best Regards,

Duane Whitty
-- 
[EMAIL PROTECTED]
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


dhclient-exit-hooks

2006-05-02 Thread fbsd
When this script runs the logger statements do not create any
message in the targeted log files.
IF I execute the same logger statements from the command
line they work as expected.
This is the boot time messages.

dc0: link state changed to DOWN
dc0: no link dc0: link state changed to UP
 got link
dc0: link state changed to DOWN
DHCPREQUEST on dc0 to 255.255.255.255 port 67
dc0: link state changed to UP
DHCPACK from 10.0.10.2
dc0: link state changed to DOWN
bound to 10.0.10.4 -- renewal in 43200 seconds.


IF I execute the cat command to issue the notification email
from the command line it works fine, but when used in the
script I get these messages during boot process.
I am running postfix launched by the sendmail wrappers
on a FreeBSD 6.0 system.

~/.mailrc: No match.
DHCPREQUEST on dc0 to 255.255.255.255 port 67
/libexec/ld-elf.so.1: Shared object libpcre.so.0 not found,
required by send-mail
dc0: link state changed to UP
DHCPREQUEST on dc0 to 255.255.255.255 port 67
DHCPACK from 10.0.10.2
dc0: link state changed to DOWN
bound to 10.0.10.4 -- renewal in 43200 seconds.




#! /bin/sh

#  Start of refresh dhcpd dns ip script
#
# This script will propagate to dhcpd the changed dns servers ip
# addresswhich dhcp-client puts in resolv.conf.
#
# In dhcpd.conf replace the option domain-name-servers line with
this
#
#  include /etc/dhcpd.name-servers;
#
# Script uses the dhcpc variables to build temp line in dhcpd
format.
# Then compare temp content to production content.
# If different replace production content with new content from temp
and
# restart dhcp to reread dhcpd.conf containing new ISP dns ip
addresses.
#
# logging event and sending email to user root is optional.
#
# Note: All LAN machines using dhcpd will not get new ISP dns ip
# addresses until they reboot or their lease comes up for renewal.
#
# Each of the following lines must be one long line. IE: no wrap
around



# load my_domain_name_servers variable with ISP dns ip addresses
from dhcpc
my_domain_name_servers=`echo $new_domain_name_servers | sed -e 's/
/, /g'`

# Create single line in file to be included in dhcpd.conf
echo option domain-name-servers $my_domain_name_servers ; 
/etc/dhcpd.name-servers.tmp

# See if different from what production file contains
cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
if [ $? -gt 0 ]; then
  # move the new file into place
  mv /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers
  # restart dhcp using whatever is appropriate for your platform
  #service dhcpd restart
  #/usr/local/etc/rc.d/isc-dhcpd.sh restart -q
  # Write message to /var/log/dhcpc.log to document event.
  logger -p user.warning -t dhclient Your ISP DNS IP addresses
changed.
  # Write message to /var/log/dhcpd.log to document event.
  logger -p local1.warning -t dhclient Your ISP DNS IP addresses
changed.

  # Send notification email to root user. This can wrap to next
line.
#  cat  EOF | mail -s dhcp client changed ISP DNS IP addresses
root
#The dhclient-exit-hook script was invoked and has determined that
your
#ISP changed the IP address of their DNS servers. The new values
have been
#auto updated to dhcpd.conf and dhcp restarted so they are now in
effect.
#
#Note: All LAN machines using dhcpd will not start using the new ISP
dns
#ip addresses until they reboot or their lease comes up for renewal.
#EOF
fi
rm -f /etc/dhcpd.name-servers.tmp
###  End of refresh dhcpd dns ip script
###


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: dhclient-exit-hooks

2006-05-02 Thread Norbert Papke
On Tuesday 02 May 2006 06:12, fbsd wrote:
 IF I execute the cat command to issue the notification email
 from the command line it works fine, but when used in the
 script I get these messages during boot process.
 I am running postfix launched by the sendmail wrappers
 on a FreeBSD 6.0 system.

 ~/.mailrc: No match.

Use sendmail(8) rather than mail(1).  mail(1) expects to be run from a user 
session and looks for the user's preferences stored in the user's ,mailrc 
file.  No user is available during the boot process.

In your script,

 #! /bin/sh

Also, try removing the space between #! and /bin/sh.  It may be causing 
some weirdness.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]