How do I run a PHP script as a service?
Hi all,
I have a PHP script which I need to run as a background process (daemon/service) on my Linux box. I figure it'd be best to set it up like any other service such as httpd and mysql, i.e. so I can go to /etc/init.d and type:
myscript start
myscript stop
myscript status
myscript restart
etc.
Is this the correct way to go about doing this, and if so, how do I do it - can I just copy and modify one of the other scripts?
Also, if I do it this way, is there some guarantee that the script will always be running (providing I add it to one of the rc*.d directories) - i.e. if it fails will the system automatically restart it?
Thanks in advance,
Rob
|