i tried this script and works oke
but the webaliases doesn't work anymore
any upates on this
Met vriendelijke groet,
Steffan Noord
-----
When I moved the servers, I actu8ally used the cmodvsite to change the IP
addresses. That did work.
The script I used was:
#!/usr/bin/perl
##################################################################
#changes the IP addreseses of the sites
# /etc/httpd/conf/vhosts/site13
#ServerAlias www.test.com test.com
#/usr/sbin/cmodvsite --fqdn=www.test.com --webAliases www.test.com,test.com
print "What IP address do you want to change all the sites to? ";
$theipaddress = <STDIN>;
$theipaddress =~ s/ //g;
chomp ($theipaddress);
@locatearray=`ls -1 /home/sites`;
&doit();
sub doit {
foreach $sitename (@locatearray) {
$aliases = "";
chomp ($sitename);
if ($sitename eq "home" ) { } else {
######### #get the site number
$ls=`ls -la /home/sites/ | grep $sitename`;
($prev0, $prev1, $prev2, $prev3, $prev4, $prev5) =
split(/\//,$ls);
chomp ($prev3);
$sitenumber = $prev3;
$conffile = "/etc/httpd/conf/vhosts/"."$sitenumber";
######### cat that file and get the aliases then change ip and set
aliases
@cat=`cat $conffile`;
print "The conf file for $sitename is $conffile\n";
foreach $line (@cat) {
chomp ($line);
if ($line =~ /ServerAlias/ ) {
$line =~ s/ServerAlias//;
@aliases = split(/ /,$line);
$aliases = "@aliases";
$aliases =~ s/^ //;
$aliases =~ s/ /,/g;
$justthedomain = $sitename;
$justthedomain =~ s/www\.//;
print "It shows the aliases as $aliases\n";
}
}
if ($theipaddress =~ /\d/) {
system
"/usr/sbin/cmodvsite --fqdn=$sitename --webAliases=$aliases
--ipaddr=$theipaddress");
} else {
print "The IP address had no digits. It was [
$theipaddress ]\n\n";
exit;
}
}
}
}
exit;
----
Ken Marcus
Ecommerce Web Hosting by
Precision Web Hosting, Inc.
http://www.precisionweb.net