La Vita è Bella

Thursday, December 07, 2006

Make sure your often crash daemon is still running

I have used my old lap-top as a home server. Cause I'm using ADSL at home, I have to use a dynamic DNS.

I choosed a Chinese dynamic DNS provider "Peanut Shell", they've provided a Linux client to commit your IP.

But the Linux client they provided is close-source and often crashes. After it crashed, my domain name can't be kept up-to-date.

So I have to write a script to make sure it's still running:

1 #!/bin/sh
2 pid=`pidof phlinux`
3 if [ -z "$pid" ]; then
4         echo "phlinux not running, start it as daemon now..." >&2
5         /usr/local/phlinux/phlinux -d
6 else
7         echo "phlinux is running"
8 fi

Save this script in some place, and make a link to your "/etc/cron.hourly", so it will be checked every hour.

UPDATED: or maybe you don't want to get mail report on every check, I've updated the script, and you should write a script in your "/etc/cron.hourly" instead of link the script, and writes "/path/to/your/script > /dev/null"



tags: , , ,

13:41:50 by fishy - linux - Permanent Link

Revision: 1.5/1.5, last modified on 2006-12-21 @ 02:28.

Karma: 3 (51.65% out of 91 were positive) [+/-]

You can subscribe to RSS 2.0 feed for comments and trackbacks

Trackbacks:
There are currently no trackbacks for this item.
Use this TrackBack url to ping this item (right-click, copy link target). If your blog does not support Trackbacks you can manually add your trackback by using this form.

No comments yet

Add Comment



A blog about open source, patches, thoughts and geeks