Introduction
There may be a need to reset the package for a number of users because the settings were changed for a particular package and want to automate the change using a script.
Procedure
The API documentation at the following would be needed in this case: WHM API 1 Functions - changepackage
The example provided is:
whmapi1 changepackage user=username pkg=package1
If you need to loop through users that have the same pacakge then you need to get a list of those users. That can be obtained by doing something like:
grep -H ^PLAN=myplan /var/cpanel/users/*| cut -d: -f1 |cut -d/ -f5
Of course, replace "myplan" with the package/plan name. That will output a list of users on that plan/package.
Then you can simply write a script to loop through that list of users and set to the same package/plan.
#!/bin/bash
package=myplan
for user in $(grep -H ^PLAN=$package /var/cpanel/users/*| cut -d: -f1 |cut -d/ -f5)
do
whmapi1 changepackage user=$user pkg=$package
done