2013-07-19 00:28:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorDaemonManagementStatusWorkflow
|
|
|
|
extends PhabricatorDaemonManagementWorkflow {
|
|
|
|
|
|
|
|
public function didConstruct() {
|
|
|
|
$this
|
|
|
|
->setName('status')
|
|
|
|
->setSynopsis(pht('Show status of running daemons.'))
|
|
|
|
->setArguments(array());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function execute(PhutilArgumentParser $args) {
|
|
|
|
$console = PhutilConsole::getConsole();
|
|
|
|
$daemons = $this->loadRunningDaemons();
|
|
|
|
|
|
|
|
if (!$daemons) {
|
|
|
|
$console->writeErr(
|
|
|
|
"%s\n",
|
|
|
|
pht("There are no running Phabricator daemons."));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
$status = 0;
|
|
|
|
printf(
|
Show daemon arguments with `./bin/phd status`.
Summary: Fixes T4735. When running `./bin/phd`, show daemon arguments.
Test Plan:
```
./bin/phd status
PID Started Daemon Arguments
12711 May 20 2014, 9:02:52 AM PhabricatorRepositoryPullLocalDaemon []
12716 May 20 2014, 9:02:52 AM PhabricatorGarbageCollectorDaemon []
12733 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12768 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12775 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12780 May 20 2014, 9:02:54 AM PhabricatorTaskmasterDaemon []
12838 May 20 2014, 9:02:54 AM PhabricatorFactDaemon []
13436 May 20 2014, 9:03:23 AM PhabricatorRepositoryPullLocalDaemon ["X","--not","Y"]
```
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Maniphest Tasks: T4735
Differential Revision: https://secure.phabricator.com/D9208
2014-05-21 01:47:47 +02:00
|
|
|
"%-5s\t%-24s\t%-50s%s\n",
|
|
|
|
'PID',
|
|
|
|
'Started',
|
|
|
|
'Daemon',
|
|
|
|
'Arguments');
|
2013-07-19 00:28:56 +02:00
|
|
|
foreach ($daemons as $daemon) {
|
|
|
|
$name = $daemon->getName();
|
|
|
|
if (!$daemon->isRunning()) {
|
|
|
|
$daemon->updateStatus(PhabricatorDaemonLog::STATUS_DEAD);
|
|
|
|
$status = 2;
|
|
|
|
$name = '<DEAD> '.$name;
|
|
|
|
}
|
|
|
|
printf(
|
Show daemon arguments with `./bin/phd status`.
Summary: Fixes T4735. When running `./bin/phd`, show daemon arguments.
Test Plan:
```
./bin/phd status
PID Started Daemon Arguments
12711 May 20 2014, 9:02:52 AM PhabricatorRepositoryPullLocalDaemon []
12716 May 20 2014, 9:02:52 AM PhabricatorGarbageCollectorDaemon []
12733 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12768 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12775 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12780 May 20 2014, 9:02:54 AM PhabricatorTaskmasterDaemon []
12838 May 20 2014, 9:02:54 AM PhabricatorFactDaemon []
13436 May 20 2014, 9:03:23 AM PhabricatorRepositoryPullLocalDaemon ["X","--not","Y"]
```
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Maniphest Tasks: T4735
Differential Revision: https://secure.phabricator.com/D9208
2014-05-21 01:47:47 +02:00
|
|
|
"%5s\t%-24s\t%-50s%s\n",
|
2013-07-19 00:28:56 +02:00
|
|
|
$daemon->getPID(),
|
|
|
|
$daemon->getEpochStarted()
|
|
|
|
? date('M j Y, g:i:s A', $daemon->getEpochStarted())
|
|
|
|
: null,
|
Show daemon arguments with `./bin/phd status`.
Summary: Fixes T4735. When running `./bin/phd`, show daemon arguments.
Test Plan:
```
./bin/phd status
PID Started Daemon Arguments
12711 May 20 2014, 9:02:52 AM PhabricatorRepositoryPullLocalDaemon []
12716 May 20 2014, 9:02:52 AM PhabricatorGarbageCollectorDaemon []
12733 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12768 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12775 May 20 2014, 9:02:53 AM PhabricatorTaskmasterDaemon []
12780 May 20 2014, 9:02:54 AM PhabricatorTaskmasterDaemon []
12838 May 20 2014, 9:02:54 AM PhabricatorFactDaemon []
13436 May 20 2014, 9:03:23 AM PhabricatorRepositoryPullLocalDaemon ["X","--not","Y"]
```
Reviewers: epriestley, #blessed_reviewers
Reviewed By: epriestley, #blessed_reviewers
Subscribers: epriestley, Korvin
Maniphest Tasks: T4735
Differential Revision: https://secure.phabricator.com/D9208
2014-05-21 01:47:47 +02:00
|
|
|
$name,
|
|
|
|
csprintf('%LR', $daemon->getArgv()));
|
2013-07-19 00:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|