How to make a bash or shell script run as daemon?

Say i have a simple example:

root@server [/etc/init.d]# cat /root/scripts/test.sh
while sleep 5
do
echo "how are u mate" >> /root/scripts/test.log
done
root@server [/etc/init.d]#

Instead of using rc.local to start or another script to check status, I would like make it as daemon, where i can do the following:

service mytestdaemon start/stop/status

while :; do
     echo "how are u mate" >> /root/scripts/test.log
     sleep 5
done

Start the script with nohup and & if you want to have it run in the background and running still, if you log out.

Nah... I don't want to use the common rc.local or nohup method. The script i wrote is for testing only. I wish to use daemon