the script:

#!/bin/sh
#
# daemon cron script can be use with anything program that have a pid files
# zuan(at)mylinux.net.my|daemon.cron|200810729|2343
#

daemon_dir=”/path/to/your/program”
daemon_exec=”program”
daemon_pid=”/path/to/your/program.pid”

#### don’t touch below here ####

cd $daemon_dir

# make sure filesystem isn’t full
freespace=`df -k . | tail -1 | awk {’print $4′}`
if [ $freespace -lt 10 ]; then
echo “Filesystem Full!”
exit
fi

# see if stale pid file
if [ -f $daemon_pid ]; then
pid=`cat $daemon_pid`
if [ `ps -p $pid | wc -l` -eq 2 ]; then
exit
else
echo “Stale PID File”
fi
fi

echo “Starting Your Deamon Process…”
$daemon_exec

the crontab check every 5 minutes:

*/5 * * * * /path/to/your/daemon.cron &>/dev/null

oh ya don’t forget to chown +x your daemon.cron or what ever you name it

Thank You