Simple way to change reseller IP and all accounts from shell?

Wyatt Epp

Registered
PartnerNOC
Oct 29, 2011
3
0
51
cPanel Access Level
DataCenter Provider
Simple way to change reseller IP from shell? [Partially Solved]

A reseller with more than fifty resold accounts wants a static IP and wants all of his domains on it. The UI for this is rather onerous; can anyone direct me to the relevant scripts for accomplishing this without half an hour of mouse-clicking? Thanks.

Partial Solution:
Change reseller's shared IP in WHM (still not sure how to get that into a script), then:
Code:
#!/usr/bin/env bash
RESELLER=$1
OLDIP=$2
NEWIP=$3

for I in $(grep " $RESELLER" /etc/trueuserowners|cut -f1 -d:);do 
    if grep -q "$OLDIP" /var/cpanel/users/$I;then
        echo "$I..."
        /usr/local/cpanel/bin/setsiteip -u $I $NEWIP
    fi
done
I'm going to clean it up a bit more, but you get the gist.

And the question remains: How can I automate this entirely?
 
Last edited:

Indianets

Well-Known Member
PartnerNOC
Jun 13, 2008
69
0
56
cPanel Access Level
Root Administrator
Re: Simple way to change reseller IP from shell? [Partially Solved]

Change reseller's shared IP in WHM (still not sure how to get that into a script)
And the question remains: How can I automate this entirely?
And here you go, it was rather simpler than you could think :P

Code:
touch /var/cpanel/mainips/$RESELLER
echo -n $IP > /var/cpanel/mainips/$RESELLER
Integrate with above code and enjoy!

- Vijay :D