6 Star 10 Fork 6

pizza / piz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
monitor.php 575 Bytes
一键复制 编辑 原始数据 按行查看 历史
程朝 提交于 2018-04-18 15:55 . 增加 monitor.php
#!/usr/bin/env php
<?php
require_once "./frame/base.php";
swoole_timer_tick(\Piz\Config::get_instance ()->get('app.monitor.timer'),function ($timer_id){
$port = \Piz\Config::get_instance ()->get('app.port');
$restart = \Piz\Config::get_instance ()->get('app.monitor.restart');
$sh = "netstat -anp 2>/dev/null | grep {$port} | grep LISTEN | wc -l ";
$res = intval(shell_exec($sh));
if(empty($res)){
echo date('Y-m-d H:i:s'),"\t","服务下线",PHP_EOL;
if($restart){
echo shell_exec('php start.php start');
}
}
});
PHP
1
https://gitee.com/pizzzz/piz.git
git@gitee.com:pizzzz/piz.git
pizzzz
piz
piz
master

搜索帮助