File: greylistclean.cron

package info (click to toggle)
sa-exim 4.2-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 356 kB
  • ctags: 154
  • sloc: ansic: 1,296; perl: 200; makefile: 108; sh: 77
file content (28 lines) | stat: -rw-r--r-- 1,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#
# This file cleans up SA-Exim greylisting tuplets
# You should install this file in /etc/cron.hourly

# Delete Greylisted entries that we deem too old (two days)
# alternate way to delete, slightly more secure, but not needed anymore now
# that filenames are cleaned up
#find /var/spool/sa-exim/tuplets/ -type f -mmin +2880 -exec bash -c 'grep -q "Status: Greylisted" "{}" && /bin/rm "{}"' \;

# Uncomment these 2 lines if you want an hourly cron mail with the greylist
# removes
#echo "Greylist removes"
#find /var/spool/sa-exim/tuplets/ -type f -mmin +2880 -print0 | xargs -0 grep "Status: Greylisted" | sed "s/:Status: Greylisted//" 
find /var/spool/sa-exim/tuplets/ -type f -mmin +2880 -print0 | xargs -0 grep "Status: Greylisted" | sed "s/:Status: Greylisted//" | xargs -r rm 


# Delete all entries older than 2 weeks
# Uncomment these 2 lines if you want an hourly cron mail with the whitelist
# removes
#echo "Whitelist removes"
#find /var/spool/sa-exim/tuplets/ -type f -mtime +14 -print
find /var/spool/sa-exim/tuplets/ -type f -mtime +14 -print0 | xargs -r0 rm

# Clean empty directories
find /var/spool/sa-exim/tuplets/ -type d -print0 | xargs -r0 rmdir 2>/dev/null

exit 0