Bit Twister: Is this the dhclient-exit-hooks you were talking about?



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



Relevant Pages

  • Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
    ... I went looking at the google search you sent me on and found this ... I want my hostname to be ohmster.com so will this script not allow me ... I forgot to munge it out and I really wish that you would not have ... Put "messageforohmster" in message body ...
    (alt.os.linux)
  • Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
    ... I went looking at the google search you sent me on and found this ... That was a script I was running awhile back. ... The params file is read by the firewall manager shorewall. ... Put "messageforohmster" in message body ...
    (alt.os.linux)
  • Re: simple script to read and parse mailbox
    ... Sorry to bovver you again here's script. ... the plain text message body of an emails in the testwwws users mailbox. ... # 'r+' opens the file for both reading and writing. ...
    (comp.lang.python)
  • Re: temporarily change hostname and uname
    ... generated from another script or something? ... Else for the hostname and/or uname... ... On my production cluster I have separate license files for each server ...
    (AIX-L)
  • Re: help! networking/computer security problem
    ... > THe one I get when I do nslookup on the output of ifconfig. ... That would be *a* hostname, but normally should not be THE system's ... Each network interface can have its own name. ... DHCP clients can be configured to run a script upon ...
    (comp.os.linux.security)