Index: [Article Count Order] [Thread]

Date:  Wed, 5 Mar 2008 10:59:51 +0100
From:  "Steffan" <snoord (at mark) planet.nl>
Subject:  [coba-e:12174] Re: Updating  from command line
To:  <coba-e (at mark) bluequartz.org>
Message-Id:  <046801c87ea7$a7c6f010$7800000a@pc11>
In-Reply-To:  <1ea001c801f5$a8016c60$6700a8c0@OfficeKen>
References:  <200709280216.l8S2G4TY027333 (at mark) admin.xnet.com.mx> <1cf701c80189$7df5b0a0$6700a8c0 (at mark) OfficeKen> <1ea001c801f5$a8016c60$6700a8c0 (at mark) OfficeKen>
X-Mail-Count: 12174

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