La Vita è Bella


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"

13:41:50 by fishy - Permanent Link

May the Force be with you. RAmen