If any of you pay for your dedicated servers, you probably have an issue with running out of memory once in a while (especially if your server also runs your telephone system and edits images, etc); and if you run out of memory, then you're probably in the same boat that i'm in: services start failing, starting with NAMED!!!! As a result, no one can get to your websites, which sucks. What's worse, there's no way to know, until the next time you try to get to it (/them).
I have a solution for this
. I'm not a shell scripting kinda guy (I've got a few good ones for video transcoding, but that's it), so i'm sure that most of you can enhance this by far. It's so retardedly simple, that i'm not even attaching it. All it does, is check to see if your site resolved, and if not, it sends you an email, and it also can play a sound file to wake you up, in case you're sleeping. You run this as a CRON job, every so often, from your LOCAL machine, and it SHOULD even work from your servers, even if their DNS is down, because it does not mean their NETWORK is down. I haven't tested it on my live servers though, because it works fine from here:
if /usr/bin/dig ionisis.com | /bin/grep -q "ANSWER: 0"
Subject:The Ionisis System is Down!!!
The Ionisis System is Down!!!
Trying to bring it back up now...
If i can't bring it up myself, then you must ssh into it, su - in as root, and type: service named start" | /usr/sbin/sendmail -t
/sbin/service turbopanel stop
/sbin/service named start
I would LOVE to have been able to indent my code here, but i don't know how to, without screwing the headers up! Hope it helps someone else.
PS: For those of you who ARE shell scripting Gurus, i'm sure that someone could edit it so that it could optionally also ping the ip address of your server(s) to make sure the network is not also down. I, myself, am not worried about it, but i thought i'd mention the idea in case someone else could use something like that.
Also, if you have many domains, but they are on the same server, then you do not need to duplicate this for each domain, as they all use the same dns server. However, if your domains are on different servers, then you'll want to put an entry for each separate server in the shell script. Remember to chmod +x for this.