Remove Older mails from cpanel server
In order to do this, Just login to your server as root and enter below script in a file.
root:~#vim mail.sh
#!/bin/bash
IFS=”$”
cd /home
find -P /home/*/mail/*/*/* -mindepth 1 -maxdepth 1 -mtime ‘+300′ | while read OLDMAIL; do
echo “${OLDMAIL} …”
rm -f “${OLDMAIL}”
done
Give 755 permission and Execute this script using below command.
sh mail.sh
OR
./mail.sh
Note :
ctime
ctime is the inode or file change time. The ctime gets updated when the file attributes are changed, like changing the owner, changing the permission or moving the file to an other filesystem but will also be updated when you modify a file.
mtime
mtime is the file modify time. The mtime gets updated when you modify a file. Whenever you update content of a file or save a file the mtime gets updated. Most of the times ctime and mtime will be the same, unless only the file attributes are updated. In that case only the ctime gets updated.
atime
atime is the file access time. The atime gets updated when you open a file but also when a file is used for other operations like grep, sort, cat, head, tail and so on.