jmhobbs

Finding 500 Errors On DreamHost

Recently I've been getting 500 errors once in a while on my DH account. This is usually because a process is long running and the DH monitor kills it for consuming too many resources. Meh. The real cause is putting waaay to much stuff on a shared account.

So, to see what my culripts are I wrote a quick script that I'm hooking to a cron job. First I'll see what domains are generating 500 errors, and then later I'll try to locate the exact scripts and clean them up.

500-Error-Finder.sh

#!/bin/bash

cd /home/jmhobbs/logs

for i in *; do
  if [ -d "$i" ] && [ -f "$i/http/error.log.0" ]; then
    ERRS=$( grep internal_error.html $i/http/error.log.0 | wc -l )
    if [ "0" != "$ERRS" ]; then
      echo "# $i - $ERRS"
    fi
  fi
done

The output looks like this.

[pristina]$ ./500-Error-Finder.sh 
# gallery.velvetcache.org - 11
[pristina]$