Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED Bulk Reset Package Bandwidth Limit for all users on multiple servers

Discussion in 'General Discussion' started by fatidol, Jul 12, 2018.

Tags:
  1. fatidol

    fatidol Registered

    Joined:
    Jul 12, 2018
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Slovenia
    cPanel Access Level:
    Root Administrator
    Hi guys,

    in our infrastructure we have a lot of cPanel servers (100+) and we have bandwidth limits on packages controlled by Puppet. Recently we changed BW limit but this limits are changed only on newly created accounts the old ones stay the same.

    Looking into /scripts directory does not reveal any scripts that could reset to package Bandwidth limit for user or maybe all users on a server. I've also checked API documentation if there is anything but i could not find nothing to grasp on. I know this can be changed for an account if you go to Home »Account Functions »Reset Account Bandwidth Limit and click on every possible account, but this is not the best solution if you have such a big scope of servers.

    One thing i tried is to change BWLIMIT to the value of new packages limit in /var/cpanel/users and run the following script /usr/local/cpanel/scripts/updateuserdomains but if i go to Home »Account Functions »Modify an Account i can still see message in red saying: "Package value: 1,000,000,000"

    Is there any other way to change this via SSH for mass action of Reset Account Bandwidth Limit?

    Thanks, A.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @fatidol,

    If you changed the bandwidth limit itself on a package, the new limit should automatically apply to any accounts assigned that package. If that did not happen, could you let us know the full steps you took to edit the existing package?

    Or, are you attempting to simply reset the existing bandwidth usage for multiple accounts, regardless of the value associated with the package assigned to the account?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. fatidol

    fatidol Registered

    Joined:
    Jul 12, 2018
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Slovenia
    cPanel Access Level:
    Root Administrator
    sorry for the confusion, i would like to reset the existing bandwidth limit for multiple accounts if that is possible.

    Best, A.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @fatidol,

    There's no option to do this for multiple accounts, but simply editing the package associated with the accounts using WHM >> Edit a Package will achieve the same result. It automatically updates the assigned bandwidth limit for any account assigned that package to the new bandwidth limit.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. fatidol

    fatidol Registered

    Joined:
    Jul 12, 2018
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Slovenia
    cPanel Access Level:
    Root Administrator
    Hey,

    thank you for your suggestion, this issue was resolved with the following command that searches for all packages that have BWLIMIT set to 100000000 and changes only for them.

    Code:
    while read -u 9 package ; do whmapi1 editpkg name=$package bwlimit=100000000; done 9< <( cd /var/cpanel/packages/ ; fgrep -R -l 'BWLIMIT=100000000' )
    Hope this helps anyone who is looking for similar action.

    Best, A.

    Note: This also generated email for each changed package to default sysadmin address, so proceed with caution.
     
    cPanelMichael likes this.
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @fatidol,

    I'm glad to see you were able to solve the issue. Thank you for sharing the solution.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice