You could have just googled for how to create a daemon process...

http://www.enderunix.org/docs/eng/daemon.php