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) {
|
if (!$daemons) {
|
||||||
echo "There are no running Phabricator daemons.\n";
|
echo "There are no running Phabricator daemons.\n";
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$status = 0;
|
||||||
printf(
|
printf(
|
||||||
"%-5s\t%-24s\t%s\n",
|
"%-5s\t%-24s\t%s\n",
|
||||||
"PID",
|
"PID",
|
||||||
|
@ -52,6 +53,7 @@ final class PhabricatorDaemonControl {
|
||||||
foreach ($daemons as $daemon) {
|
foreach ($daemons as $daemon) {
|
||||||
$name = $daemon->getName();
|
$name = $daemon->getName();
|
||||||
if (!$daemon->isRunning()) {
|
if (!$daemon->isRunning()) {
|
||||||
|
$status = 2;
|
||||||
$name = '<DEAD> '.$name;
|
$name = '<DEAD> '.$name;
|
||||||
if ($daemon->getPIDFile()) {
|
if ($daemon->getPIDFile()) {
|
||||||
Filesystem::remove($daemon->getPIDFile());
|
Filesystem::remove($daemon->getPIDFile());
|
||||||
|
@ -66,7 +68,7 @@ final class PhabricatorDaemonControl {
|
||||||
$name);
|
$name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function executeStopCommand($pids = null) {
|
public function executeStopCommand($pids = null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue