[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SLUG] Re: Virtual hosts on a dynamic IP



Yer a Champ Angus,

I had to modify what you wrote below slightly as for some reason sed didn't 
like using a variable as the replacement expression..

so what I have is :

#Insert new IP in all required places.
/usr/bin/sed "s/@nospam.MYIP@nospam./`/sbin/ifconfig ppp0|grep inet|cut -c 21-33`/g" \
< /www/conf/httpd.conf.orig > /www/conf/httpd.conf
#Restart httpd
kill `ps -ax |grep /usr/sbin/httpd | cut -c 0-5`
/usr/sbin/httpd


nb I use this method below for restarting httpd because there is no rc 
files for apache in the distro of slakware that I have and because kill 
-HUP isn't too reliable as I've found with my testing of the script above 
(like it doesn't always restart it).

Many thanks,
Paul


At 09:34 AM 12/06/00 +1000, Angus Lees wrote:
>On Sun, Jun 11, 2000 at 07:37:03PM +1000, Paul Robinson wrote:
> > I use dyndns to get a hostname.. which is why I was hoping to get virutal
> > hosts working off of a name only, which it would hopefully then resolve 
> and
> > everything would be fine..
> >
> > I guess fixed IP is the only way :(
>
>nonsense - in your ip-up script (or some dhcp script or something for
>cable), just put something like this:
>
>
>  myip=$4  # for ip-up, `hostname -i` or something otherwise
>
>  sed "s/@nospam.MYIP@nospam./$myip/g" \
>    < /etc/apache/httpd.conf.orig > /etc/apache/httpd.conf
>
>  /etc/init.d/apache/reload
>
>
>and httpd.conf.orig is just a copy, with @nospam.MYIP@nospam. instead of any
>specific ip address
>
>--
>  - Gus
>--
>SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
>To unsubscribe send email to slug-request@nospam.slug.org.au with
>unsubscribe in the text

--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to slug-request@nospam.slug.org.au with
unsubscribe in the text