Help - Search - Members - Calendar
Full Version: HOWTO: empty all Trash folders for all users on all sites
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
Prethorian
Here is usefull script for empty all Trash (or any folder) in virtual site home dirs

touch trash.sh
chmod 755 trash.sh

vi trash.sh

CODE
#!/bin/sh

path=`echo /home/virtual/site*/fst/home/*/mail`

for x in $path;

do

echo "$x/$1"

cat /dev/null > $x/$1

done


use script with:

./trash.sh Trash

This will do cat /dev/null >/home/virtual/siteXX/fst/home/USER/mail/Trash

You can give Sent as argument ( ./trash.sh Sent ).

This is usefull, when users use webmail, and after delete hes messages, they forget to empty trash, and then disk quota was reached.

regards.
DomineauX
I know this is a major thread necro, but here is a simpler way to auto empty Trash.

I create /etc/cron.weekly/empty_trash containing the following:

----
#!/bin/sh
for i in `ls -1 /home/virtual/site*/fst/home/*/mail/Trash`;do >$i;done
----

chmod 755 /etc/cron.weekly/empty_trash
service crond restart


Every week the Trash is auto emptied.
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-2009 Invision Power Services, Inc.