Core Files Finder
Posted by Jacob, under Scripts RepositoryI wrote this about a year ago, to find massive amounts of core files and email them back to me.
This is best ran in the background, as the outputs are nulled. I.E:
./corefinder &
Have fun!
#!/bin/bash # Find's Core Files, and reports back TMPDIR='/tmp' subject="FindCores_Report_for_`hostname`" EMAIL="youremailaddress@email.com" rm -f $TMPDIR/findcores.* ls /var/cpanel/users/ > $TMPDIR/findcores.users for i in `cat $TMPDIR/findcores.users` do if [ -e /home/$i ]; then #echo "Checking $i" echo "Report for $i" >> $TMPDIR/findcores.$i.corefiles cd /home/$i && find . -type f -regex '.*/core\.?[0-9]*$' >> $TMPDIR/findcores.$i.corefiles if [ `cat $TMPDIR/findcores.$i.corefiles | wc -l` -lt 25 ]; then #echo "Non-Alert" rm -f $TMPDIR/findcores.$i.corefiles else #echo "Alert" cat $TMPDIR/findcores.$i.corefiles | mail -s $subject $EMAIL fi rm -f $TMPDIR/findcores.$i.corefiles fi done
