环境:windows / linux 等
安装到全局环境下:
npm install forever -g
查看进程列表:forever list
(暂时没有守护进程)
开启守护进程(相对路径定位到某文件):forever start /src/App/Controller/a.php
停止守护进程:forever stop /src/App/Controller/a.php
基本参数:
-p:文件基本路径
-l:将输出记录到日志
-o:从子脚本到外部文件得日志
--pidFile:pid所在文件路径
-e:错误日志,
--append:追加日志
--KillSignal:支持退出信号制定,用于优雅重启脚本
-c:命令执行,默认节点
标准例子:
forever start -p {{release_path}} -l {{release_path}}/var/consumer/peanut-push-notice-get.log -o {{release_path}}/var/consumer/peanut-push-notice-get-out.log --pidFile={{release_path}}/var/consumer/peanut-push-notice-get.pid -e {{release_path}}/var/consumer/peanut-push-notice-get-err.log --append --killSignal=SIGTERM --minUptime=1000 --spinSleepTime=1000 -c /usr/local/bin/php {{release_path}}/bin/console peanut:push:notice:get