The BlueQuartz shell tool contain a tool called /usr/sbin/cmodvsite, which can be used to manipulate sites. Pretty much anything you can do to a site with the GUI can also be done with that command line untility. Run /usr/sbin/cmodvsite -h to see the available options and parameters. Below is a small shell script that I usually use when I have to change all sites on a BlueQuartz to a new IP-address: #!/usr/bin/perl
# List of all sites can be generated with this command: # ls -k1 /home/sites/ > sitelist.txt
system("ls -k1 /home/sites/ > sitelist.txt");
$newip = "192.168.100.100"; $sitelist = "sitelist.txt";
open(CONFIG, $sitelist); @list = <CONFIG>; close (CONFIG);
foreach $site (@list) { $size = length($site); unless ($size < 3) { chomp $site; print "Changing IP of site " . $site . " to the IP $newip \n"; system("cmodvsite --fqdn $site --ipaddress $newip"); } } Make sure to change the value for $newip in the script to the new IP address that you want the sites to run on. The script will read /home/sites, will generate a textfile called sitelist.txt that contains a list of all sites and will then run the cmodvsite command to change all sites to the new IP address. If you want to manually edit the list to only change certain sites to a new IP, comment out the first system() call and generate your sitelist.txt file manually, so that it only contains the sites where this action should be performed. |