18Feb/100
File Size Alarm
This is a useful little script to check for mail files which are over a particular size, in this case 1800 MB.
Executed daily by Cron, it notifies me by email of any files which exceed the limit.
I wrote this because Evolution started to misbehave whenever a mail file exceeded 2GB in size. The notification mail in this case goes to the user's mail account user@localhost.
#!/bin/sh # Change to mail directory - in this case for Gnome Evolution cd ~/.evolution # Create a temporary file to hold the results largefiles=`mktemp` # Find all files 1800 MB and larger and store the list in a temporary file find -size +1800M > $largefiles # Test for existence of the temporary file, and if present mail its contents to the owner if [ -s $largefiles ]; then mail -s "Mail folders approaching 2GB limit" $USER@localhost < $largefiles; fi
By the way, I'm looking for a better way to neatly post snippets of code. The box above needed tweaking this way and that to make it fit, and still it's not great.
If anyone has a slick way to do this on WordPress then I'm open to suggestions.
Edit: SyntaxHighlighter Evolved did the trick for displaying code
Edit: Changed to mktemp to handle the temporary file