Bit Twister: Is this the dhclient-exit-hooks you were talking about?
- From: Ohmster <nowayin@xxxxxxxx>
- Date: Sat, 23 Sep 2006 00:43:08 +0000 (UTC)
Hey Bit Twister,
I went looking at the google search you sent me on and found this script,
is this what you were suggesting that I run for my computer and if so,
where can I get a good copy of it without line wrap issues that may be
apparent from copying it from a google search?
I want my hostname to be ohmster.com so will this script not allow me to
do that? Where can I instert my wgets call to bring up my wgets text file
to update my domain IP addresses?
What is this script for, where did it come from?
#*******************************************************************
#*
#* dhclient-exit-hooks - Post processing dhcp client processor
#*
#* This script is called from /sbin/dhclient-script.
#* The variables exit_status, reason, and new* are set in
#* /sbin/dhclient-script.
#*
#* Install:
#* chmod +x dhclient-exit-hooks
#* cp dhclient-exit-hooks /etc/dhclient-exit-hooks
#*
#*
#*******************************************************************
if [ $exit_status -eq 0 ] ; then
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
#******** change hostname in /etc/sysconfig/network **********
echo HOSTNAME=$(hostname -s).$new_domain_name > /tmp/network
/bin/grep -v HOSTNAME /etc/sysconfig/network >> /tmp/network
## /bin/cp /tmp/netowrk /etc/sysconfig/network
## . /etc/sysconfig/network
## hostname $HOSTNAME
#******** change hostname/ip address in /etc/hosts **********
/bin/echo -e \
"${new_ip_address}\t$(hostname -s).$new_domain_name\t$(hostname
-s)" \
> /tmp/hosts
/bin/grep -v $(hostname -s) /etc/hosts >> /tmp/hosts
## /bin/cp /tmp/hosts /etc/hosts
#******* change /etc/postfix/main.cf *************************
_out_fn=/tmp/main.cf
/bin/cp /dev/null $_out_fn
while read line
do
set - $line
if [ -n "$line" ] ; then
case $1 in
myorigin)
line="myorigin = $new_domain_name" >> $_out_fn
;;
myhostname)
line="myhostname = $(hostname)" >> $_out_fn
;;
mydomain)
line="mydomain = $new_domain_name" >> $_out_fn
;;
inet_interfaces)
line="inet_interfaces = $(hostname)" >> $_out_fn
;;
relayhost)
line="relayhost = smtp.$new_domain_name" >> $_out_fn
;;
esac
fi
echo $line >> /tmp/main.cf
done < /etc/postfix/main.cf
## /bin/cp $_out_fn /etc/postfix/main.cf
## /bin/cp /etc/hosts /var/spool/postfix/etc/
## /bin/cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf
fi
fi
exit 0
#************* end /etc/dhclient-exit-hooks **************************
--
~Ohmster
theohmster at comcast dot net
Put "messageforohmster" in message body
to pass my spam filter.
.
- Follow-Ups:
- Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
- From: Walter Mautner
- Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
- From: Bit Twister
- Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
- Prev by Date: Re: Can I use /etc/dhclient-exit-hooks to run an IP updater?
- Next by Date: Re: Can I use /etc/dhclient-exit-hooks to run an IP updater?
- Previous by thread: HylaFax
- Next by thread: Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
- Index(es):
Relevant Pages
|