...
|
...
|
@@ -276,24 +276,32 @@ function sync($email_id,$worker_id){ |
|
|
|
|
|
|
|
|
|
|
|
switch ($argv[1]){
|
|
|
$ps = "ps -ef | grep \"sync.php start\" | grep -v grep | wc -l";
|
|
|
|
|
|
switch ($argv[1]??0){
|
|
|
case 'start':{
|
|
|
$num = exec($ps);
|
|
|
if($num){
|
|
|
echo '正则运行,请勿重复运行';
|
|
|
}else{
|
|
|
start();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
case 'stop':{
|
|
|
\Co\run(function (){
|
|
|
echo "正在退出程序...\n非必要请不要强制kill掉进程\n";
|
|
|
|
|
|
redis()->set(SYNC_RUNNING_REDIS_KEY,'stop');
|
|
|
|
|
|
while (true){
|
|
|
$num = exec("ps -ef | grep \"sync.php start\" | grep -v grep | wc -l");
|
|
|
|
|
|
$num = exec($ps);
|
|
|
if(!$num){
|
|
|
break;
|
|
|
}
|
|
|
co::sleep(0.5);
|
|
|
sleep(1);
|
|
|
}
|
|
|
echo "已退出程序\n";
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
default:{
|
...
|
...
|
@@ -309,4 +317,3 @@ switch ($argv[1]){ |
|
|
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|