mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
Remove daemon PID files for missing daemons when running "phd stop"
Summary: When we try to kill a daemon but discover it isn't running, we should remove the PID file. We can also simplify the logic here. Test Plan: Ran "phd stop" a couple of times, subsequent runs did not try to stop a legion of dead daemons. Reviewers: btrahan, jungejason Reviewed By: btrahan CC: aran Maniphest Tasks: T781 Differential Revision: https://secure.phabricator.com/D1421
This commit is contained in:
parent
56447ed2cc
commit
1651be91ec
1 changed files with 4 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -98,7 +98,8 @@ final class PhabricatorDaemonControl {
|
|||
return 0;
|
||||
}
|
||||
|
||||
$killed = array();
|
||||
$all_daemons = $running;
|
||||
|
||||
foreach ($running as $key => $daemon) {
|
||||
$pid = $daemon->getPID();
|
||||
$name = $daemon->getName();
|
||||
|
@ -109,7 +110,6 @@ final class PhabricatorDaemonControl {
|
|||
unset($running[$key]);
|
||||
} else {
|
||||
posix_kill($pid, SIGINT);
|
||||
$killed[] = $daemon;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,10 +132,9 @@ final class PhabricatorDaemonControl {
|
|||
$pid = $daemon->getPID();
|
||||
echo "KILLing daemon {$pid}.\n";
|
||||
posix_kill($pid, SIGKILL);
|
||||
$killed[] = $daemon;
|
||||
}
|
||||
|
||||
foreach ($killed as $daemon) {
|
||||
foreach ($all_daemons as $daemon) {
|
||||
if ($daemon->getPIDFile()) {
|
||||
Filesystem::remove($daemon->getPIDFile());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue