mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-23 05:01:13 +01:00
'phd status' should exit with non-zero if daemons are not running.
'phd status' may be invoked by tools (such as puppet) which need to make automated decisions about whether to start/restart the daemon. To enable this, 'phd status' now exits with 0 if all daemons are running, 1 if no daemons are running, and 2 if some (but not all) daemons are running.
This commit is contained in:
parent
02f40fd7ef
commit
420d6426f9
1 changed files with 4 additions and 2 deletions
|
@ -41,9 +41,10 @@ final class PhabricatorDaemonControl {
|
|||
|
||||
if (!$daemons) {
|
||||
echo "There are no running Phabricator daemons.\n";
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
$status = 0;
|
||||
printf(
|
||||
"%-5s\t%-24s\t%s\n",
|
||||
"PID",
|
||||
|
@ -52,6 +53,7 @@ final class PhabricatorDaemonControl {
|
|||
foreach ($daemons as $daemon) {
|
||||
$name = $daemon->getName();
|
||||
if (!$daemon->isRunning()) {
|
||||
$status = 2;
|
||||
$name = '<DEAD> '.$name;
|
||||
if ($daemon->getPIDFile()) {
|
||||
Filesystem::remove($daemon->getPIDFile());
|
||||
|
@ -66,7 +68,7 @@ final class PhabricatorDaemonControl {
|
|||
$name);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return $status;
|
||||
}
|
||||
|
||||
public function executeStopCommand($pids = null) {
|
||||
|
|
Loading…
Reference in a new issue