Skip to content

kalons/kalondaemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

USAGE:  


[root@localhost ~]# php test.php start
Daemon started with pid xxx...
Stop flag is 0
Stop flag is 0
Stop flag is 0

Stop flag is 1  ("php test.php stop" executed in another shell, process with id xxx stopped)


基本原理就是cli模式下执行php test.php start之后其会成为一个后台守护进程,进程号为xxx,守护进程主逻辑是一个死循环,不断的输出
stop flag的值,然后睡眠5秒。当系统接收到php test.php stop命令之后,会给守护进程发送一个信号,守护进程收到信号之后会将Stop flag
设置成1,然后主循环就会终止,守护进程退出。
可以据此守护模型扩展开发PHP后台服务,PHP多进程任务等等。








   

Releases

No releases published

Packages

No packages published

Languages