Mass Change VirtualHost IP via CLI/SSH
here is what I have tried so far what am I missing?
changed it to.....
Looks like these changed just fine ;-)
httpd.conf is still showing old IP
root@server [~]# cat /var/cpanel/mainip
192.168.0.10
changed it to.....
root@server [~]# cat /var/cpanel/mainip
192.168.2.10
root@server [~]# grep -rn 192.168. /var/cpanel/users
/var/cpanel/users/user1:13:IP=192.168.0.10
/var/cpanel/users/user2:13:IP=192.168.0.10
/var/cpanel/users/user3:13:IP=192.168.0.10
root@jeff [~]# sed -i 's/192.168.0.10/192.168.2.10/g' /var/cpanel/users/*
root@server [~]# grep -rn 192.168. /var/cpanel/users
/var/cpanel/users/user1:13:IP=192.168.2.10
/var/cpanel/users/user2:13:IP=192.168.2.10
/var/cpanel/users/user3:13:IP=192.168.2.10
Looks like these changed just fine ;-)
root@server [~]# /usr/local/cpanel/scripts/updateuserdomains
root@server [~]# /scripts/rebuildhttpdconf
httpd.conf is still showing old IP
root@server [~]# cat /usr/local/apache/conf/httpd.conf | grep '
-
root@server [~]# strace -F /scripts/rebuildhttpdconf 2>&1 | grep 192.168. read(3, "pst0\5\t\2\0\0\0\1\n\f192.168.2.10", 8192) = 25 read(3, "192.168.2.10\n", 8192) = 13 stat("/var/cpanel/userdata/nobody/192.168.0.10", {st_mode=S_IFREG|0644, st_size=293, ...}) = 0 stat("/var/cpanel/userdata/nobody/192.168.0.10", {st_mode=S_IFREG|0644, st_size=293, ...}) = 0 stat("/var/cpanel/userdata/nobody/192.168.0.10", {st_mode=S_IFREG|0644, st_size=293, ...}) = 0 open("/var/cpanel/userdata/nobody/192.168.0.10.cache", O_RDONLY) = 3 stat("/var/cpanel/userdata/nobody/192.168.0.10_SSL", 0x7f09f5889880) = -1 ENOENT (No such file or directory) [pid 11374] read(5, "#\n#"..., 4096) = 4096
0 -
Solved the problem with this method root@server [~]# sed -i 's/192.168.0.10/192.168.2.10/g' /usr/local/apache/conf/httpd.conf root@server [~]# /usr/local/cpanel/bin/userdata_update root@server [~]# /scripts/rebuildhttpdconf info [rebuildhttpdconf] Missing owner for domain , force lookup to root info [rebuildhttpdconf] Missing group for domain , using nobody Built /usr/local/apache/conf/httpd.conf OK
root@server [~]# cat /usr/local/apache/conf/httpd.conf | grep '
0 -
Hello :) Note that you may also find this command helpful in the future: # /usr/local/cpanel/bin/setsiteip --help Usage: /usr/local/cpanel/bin/setsiteip [-u user | domain] ip Usage: /usr/local/cpanel/bin/setsiteip --help
Thank you.0
Please sign in to leave a comment.
Comments
3 comments