Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,354
79
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hi! Today I have a maintanance question.

Let's see: I run several VPS servers which over time have been used by different resellers. Some of them have evolved and moved to higher plans, others have quit. Others just have a mess because they are designers or non-tech people not willing to learn how to properly setup packages and features. I'm aware that every server have almost 300 different packages configured. For some of them one can easily detect if they are actually being used. But I need a way to detect WHICH PACKAGES AND FEATURES AREN'T BEING ACTUALLY USED, in order to be able to delete it without causing any harm.

Is there any command I can run in the console? some grep maybe to compare the existing packages with the actually assigned ones?
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
Hello,

You can find out all used package list through following command

grep -nr "PLAN=" /var/cpanel/users/ | cut -d ":" -f3 | sort | uniq -c | sort -nr | awk {'print $2'}
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,354
79
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello,

You can find out all used package list through following command
Great. The next step is to know what are the unused ones. Thanks!


Hello :)
The following thread may be useful to you:
How to remove packages for non-existing users
I see. But I'm having the same issue as user furquan. I can run the command but the unused packages aren't being deleted. Should I open a ticket? or is there any workaround? because the post you are linking at was last answered on Apr 2011...

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
You will need to manually delete the packages that you no longer use. Packages are stored in:

Code:
/var/cpanel/packages/
You may want to copy the packages that you do use (including the default package) to a temporary directory. Then, delete all of the packages in /var/cpanel/packages/ and copy back over the ones you use.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
I was more so referencing other user-based solutions in the other thread regarding removing packages. You may want to review them before running any custom commands or scripts as some of them appear to remove all packages. The autorepair script you mentioned still functions normally:

Code:
/scripts/autorepair cleanup_dead_package_limits
It's not designed to delete packages, but rather to clean up the /var/cpanel/package-limits.yaml file.

Thank you.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,354
79
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
oops ok, I missed that. What is the /var/cpanel/package-limits.yaml file for?

- - - Updated - - -

I see the script by user vivek in that post, and I believe it will delete non-reseller packages. If I would test it, I'd rather modify it to run in a separate-test-folder, and erasing the line which actually delete the files at the end, to prevent causing any harm.