Help - Search - Members - Calendar
Full Version: HOW to clean dirty squirrel mail restores
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
wshawn
Situation: Server admin restores a site and the /var/www/squirrelmail directories are not restored due to what ever reason (updated version already installed, Ensim changing file structures, whatever...)

Location: This is the fun part. When this situation occures you will find close to 3100 files totalling 36 megs in the site admin's home folder. (you remember --- that's the 10 meg site pacakge you sold for $12 a year that keeps sending you overage warnings because that one web page is REALLY REALLY HUGE)

This is where you can find these dirty files by looking at the /domain.com/home folder due to it showing a bloated home folder size (it is supposed to be housing a website, right?):
QUOTE
[root@secure home]# ll
total 404
drwx------  3 admin39 admin39 397312 Feb 13 01:28 dtrans
drwx-----x  3   22019 admin39   4096 Feb 13 01:28 gary
drwx-----x  3   22020 admin39   4096 Feb 13 01:28 josh
drwx-----x  4   22021 admin39   4096 Feb 13 01:28 sales


Problem: Due to the large number of files rm doesn't work without a kernel recompile or a workaround.

Trying to run the command rm -f rm -f var_www_squirrelmail* will result in:
"Argument list too long."

Solution:
ssh to your server
su - (switch to root -- you have disabled direct root login, right?)
cd /root (we have a /root/scripts for these toys)
vi killTheSquirrel
(press i to go to insert mode)
cut and paste the following:

QUOTE
rm -f var_www_squirrelmail_locale_[a-h]*
rm -f var_www_squirrelmail_locale_[i-z]*
rm -f var_www_squirrelmail_[t-z]*
rm -f var_www_squirrelmail_[o-s]*
rm -f var_www_squirrelmail_[k-n]*
rm -f var_www_squirrelmail_[h-k]*
rm -f var_www_squirrelmail_[d-g]*
rm -f var_www_squirrelmail_[a-c]*
rm -f var_www_squirrelmail*


You may also want to make sure there is a blank line at the end.

press ESC, ESC :wq ENTER (basically make sure we are out of insert mode, write the file, quit)

chmod 700 killTheSquirrel

To use the script you will need to find a directory with these bad files (or when you are notified: via over usage email's, notice the files when you first log into a site via ftp, or an irate client is tieing up your phone.)

cd /home/virtual/domain.com/home/userFolder
ll (thats LL to verify the files exist)
/root/killTheSquirrel or
/root/scripts/killTheSquirrel

What it does:
This workaround deletes a single set of these junk squirrel mail files from the respectived domain. It splits the file list into pieces being sent to rm so that it can deal with the number of files being sent.

How any sites have this problem:
We had 37 on one server (the one we just had a clean RH 4.2 image put onto and then had Ensim 4.1 installed, and lastly restored the sites and appliance)

37 sites at 36 megs each == 1.4 gigs of junk, compounded by multiple backups, transfer rates of back ups etc.

You can use find to locate these files, but it also suffers from the same:
"Argument list to long" error.

We found a site and looked at the file list to grab a file at random to look for as all the occurances have the same files listed.

QUOTE
su -
mkdir /root/killme
cd /root/killme
find /home/virtual/ -name "var_www_squirrelmail_UPGRADE.Sun_Nov*"  -print >targets
less targets


This will crank up your server load quite a bit so do it in a slow time. We went from .04 to 5.4 running this (Ensim python was also running == resource hog, so who knows how much of a hit this script caused).

This will at least tell you where to look.

To Do:
I really don't have a lot of time to figure a way to automate this at this time. If Perldork has time (or anyone else for that matter) feel free to post a quicker way of doing this. I will reserver the next post for a corrected script.
wshawn
.. space reserved
webexceed
Thanks for that!!

I just did a wicked little shortcut though and seems to work great, a quick little one line typed in as root...

CODE
find /home/virtual/*/fst/home/* -name "var_www_*" -exec rm {};


PRESTO!! All gone. icon_biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.