PDA

View Full Version : How to save space on a cPanel VPS (used for web hosting)


elix
11-25-2005, 12:17 PM
I just made a quick script that I thought would be handy for cleaning out space on cPanel VPSes.

Installation

wget http://www.medialayer.com/dev/css_install.sh
chmod 0755 css_install.sh
./css_install.sh



Updates:
- Changed default e-mail to "root" which will generally work for everybody.
- Set the find command to run as "nice" so that it does not hog CPU. (Zaf.)
- Set a default e-mail template for the e-mails sent to the address specified. This is better than using the "echo" command to generate one each run.
- Changed "automagically" to "automagicly" (Zaf).
- Cleaned up some of the code and made the css.sh file a little easier to understand.
- Made it so that the e-mail includes information about what was deleted. No need to have a logs file or folder now.

---The script will probably not be further updated unless there is a suggestion.---

charles
11-25-2005, 12:32 PM
May I suggest you name your install scripts something a little more descriptive, like "myscript_install.sh".

charles

elix
11-25-2005, 12:36 PM
Done.

Also note--I literally made this in just a few minutes, I'm probably going to optimize it a bit later

mikelbeck
11-25-2005, 01:33 PM
I just made a quick script that I thought would be handy for cleaning out space on cPanel VPSes.

You can install it with -->

wget http://www.medialayer.com/dev/css_install.sh
chmod 0755 css_install.sh
./css_install.sh

be sure to edit /usr/local/css/css.sh and input your e-mail address.

I have tested the script, but please use it at your own descression.

Note--It may take some time for the "find" command in the script to complete (depending on how much disk space your VPS uses). However, it should not affect the speed of your websites.
What does it do?

elix
11-25-2005, 01:43 PM
It will be set to run every night at 2:30AM (your VPS's time zone of course) and do the following:

- Delete every single user's .trash (in the file manager of cPanel). This really helps a lot in saving space. Everything that was deleted is logged in /usr/local/css/logs/trash.log
- Find backup files generated by cPanel (done by users generally) and e-mails you a list. You can then use rm -rf to delete each file.

:)

Zaf
11-25-2005, 02:56 PM
elix: its 'automagicly' as per the dictionary that I looked at last time :rofl:

Thanks for this script, i have it on my VPS and let it run (but doubt if it will really find anything on my VPS anyway)

elix
11-25-2005, 03:26 PM
If you want to run it right away:

cd /usr/local/css;./css.sh

vps-vince
11-25-2005, 03:46 PM
- Delete every single user's .trash (in the file manager of cPanel). This really helps a lot in saving space. Everything that was deleted is logged in /usr/local/css/logs/trash.log
- Find backup files generated by cPanel (done by users generally) and e-mails you a list. You can then use rm -rf to delete each file.

I must be missing something.
Why would you want to delete your clients backup files?

elix
11-25-2005, 03:56 PM
Usually clients will download the backups and forget to delete them. That happens 95% of the time--besides the date is provided with the backup, i'd suggest deleting them if they are over a few weeks old.