Link to home
Start Free TrialLog in
Avatar of yasincelik
yasincelik

asked on

how to do a debian daemon with php script

hi all,

i want to make a debian init.d daemon which runs a php script in shell but i want this to run infinitely without exploiting all the system resources. it basically checks a mysql db and with conditions make files in a temp directory.

first i made a cronjob which runs every minute but it's not enough for me because it must continously check db and if the conditions met it must create temp files in real-time.

in the below link i could make daemon sh script which runs my php file, but if i put my script in a do loop block cpu is getting %50 load.

https://www.experts-exchange.com/questions/22807337/Simple-init-d-daemon-in-Debian-Etch.html

hope i could explain my problem.
phpscript.sh.txt
index2.php.txt
ASKER CERTIFIED SOLUTION
Avatar of aerovoyager
aerovoyager

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yasincelik
yasincelik

ASKER

thanks for the solution. i will use this method which i was exactly looking for.

and i found in google this article which explains system_daemon very good.

http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/