Page MenuHomePhabricator

D11861.diff
No OneTemporary

D11861.diff

diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
@@ -19,11 +19,18 @@
'By default, **phd start** will free all task leases held by '.
'the daemons. With this flag, this step will be skipped.'),
),
+ array(
+ 'name' => 'force',
+ 'help' => pht(
+ 'Start daemons even if daemons are already running.'),
+ ),
));
}
public function execute(PhutilArgumentParser $args) {
- return $this->executeStartCommand($args->getArg('keep-leases'));
+ return $this->executeStartCommand(
+ $args->getArg('keep-leases'),
+ $args->getArg('force'));
}
}
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
--- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
@@ -286,25 +286,28 @@
/* -( Commands )----------------------------------------------------------- */
- protected final function executeStartCommand($keep_leases = false) {
+ protected final function executeStartCommand($keep_leases, $force) {
$console = PhutilConsole::getConsole();
- $running = $this->loadRunningDaemons();
-
- // This may include daemons which were launched but which are no longer
- // running; check that we actually have active daemons before failing.
- foreach ($running as $daemon) {
- if ($daemon->isRunning()) {
- $message = pht(
- "phd start: Unable to start daemons because daemons are already ".
- "running.\n".
- "You can view running daemons with 'phd status'.\n".
- "You can stop running daemons with 'phd stop'.\n".
- "You can use 'phd restart' to stop all daemons before starting new ".
- "daemons.");
-
- $console->writeErr("%s\n", $message);
- exit(1);
+ if (!$force) {
+ $running = $this->loadRunningDaemons();
+
+ // This may include daemons which were launched but which are no longer
+ // running; check that we actually have active daemons before failing.
+ foreach ($running as $daemon) {
+ if ($daemon->isRunning()) {
+ $message = pht(
+ "phd start: Unable to start daemons because daemons are already ".
+ "running.\n\n".
+ "You can view running daemons with 'phd status'.\n".
+ "You can stop running daemons with 'phd stop'.\n".
+ "You can use 'phd restart' to stop all daemons before starting ".
+ "new daemons.\n".
+ "You can force daemons to start anyway with --force.");
+
+ $console->writeErr("%s\n", $message);
+ exit(1);
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 7, 5:25 AM (4 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7321749
Default Alt Text
D11861.diff (3 KB)

Event Timeline