2013-07-19 00:28:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorDaemonManagementRestartWorkflow
|
|
|
|
extends PhabricatorDaemonManagementWorkflow {
|
|
|
|
|
2015-01-15 21:42:07 +01:00
|
|
|
protected function didConstruct() {
|
2013-07-19 00:28:56 +02:00
|
|
|
$this
|
|
|
|
->setName('restart')
|
2015-05-22 09:27:56 +02:00
|
|
|
->setSynopsis(pht('Stop, then start the standard daemon loadout.'))
|
Send graceful shutdown signals to daemons in Phabricator
Summary:
Fixes T5855. Adds a `--graceful N` flag to `phd stop` and `phd restart`.
`phd` will send SIGINT, wait `N` seconds, SIGTERM, wait 15 seconds, and SIGKILL. By default, `N` is 15.
Test Plan:
- Ran `bin/phd debug ...` and used `^C` to interrupt daemons. Saw graceful shutdown behavior, and abrupt termination on multiple `^C`.
- Ran `bin/phd start`, `bin/phd stop` and `bin/phd restart` with `--graceful` set to various things, notably `0`. Saw graceful shutdowns on the CLI and in the web UI. With `0`, abrupt shutdowns.
Reviewers: btrahan, hach-que
Reviewed By: hach-que
Subscribers: epriestley
Maniphest Tasks: T5855
Differential Revision: https://secure.phabricator.com/D10228
2014-08-12 05:18:31 +02:00
|
|
|
->setArguments(
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'name' => 'graceful',
|
|
|
|
'param' => 'seconds',
|
|
|
|
'help' => pht(
|
|
|
|
'Grace period for daemons to attempt a clean shutdown, in '.
|
|
|
|
'seconds. Defaults to __15__ seconds.'),
|
|
|
|
'default' => 15,
|
|
|
|
),
|
2015-02-17 20:14:34 +01:00
|
|
|
array(
|
|
|
|
'name' => 'gently',
|
|
|
|
'help' => pht(
|
|
|
|
'Ignore running processes that look like daemons but do not '.
|
|
|
|
'have corresponding PID files.'),
|
|
|
|
),
|
2014-08-26 23:12:31 +02:00
|
|
|
array(
|
|
|
|
'name' => 'force',
|
|
|
|
'help' => pht(
|
|
|
|
'Also stop running processes that look like daemons but do '.
|
|
|
|
'not have corresponding PID files.'),
|
|
|
|
),
|
2015-02-24 02:58:01 +01:00
|
|
|
$this->getAutoscaleReserveArgument(),
|
Send graceful shutdown signals to daemons in Phabricator
Summary:
Fixes T5855. Adds a `--graceful N` flag to `phd stop` and `phd restart`.
`phd` will send SIGINT, wait `N` seconds, SIGTERM, wait 15 seconds, and SIGKILL. By default, `N` is 15.
Test Plan:
- Ran `bin/phd debug ...` and used `^C` to interrupt daemons. Saw graceful shutdown behavior, and abrupt termination on multiple `^C`.
- Ran `bin/phd start`, `bin/phd stop` and `bin/phd restart` with `--graceful` set to various things, notably `0`. Saw graceful shutdowns on the CLI and in the web UI. With `0`, abrupt shutdowns.
Reviewers: btrahan, hach-que
Reviewed By: hach-que
Subscribers: epriestley
Maniphest Tasks: T5855
Differential Revision: https://secure.phabricator.com/D10228
2014-08-12 05:18:31 +02:00
|
|
|
));
|
2013-07-19 00:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function execute(PhutilArgumentParser $args) {
|
2015-02-17 20:14:34 +01:00
|
|
|
$err = $this->executeStopCommand(
|
|
|
|
array(),
|
|
|
|
array(
|
|
|
|
'graceful' => $args->getArg('graceful'),
|
|
|
|
'force' => $args->getArg('force'),
|
|
|
|
'gently' => $args->getArg('gently'),
|
|
|
|
));
|
2013-07-19 00:28:56 +02:00
|
|
|
if ($err) {
|
|
|
|
return $err;
|
|
|
|
}
|
2015-02-17 20:14:34 +01:00
|
|
|
|
2015-02-24 02:58:01 +01:00
|
|
|
return $this->executeStartCommand(
|
|
|
|
array(
|
|
|
|
'reserve' => (float)$args->getArg('autoscale-reserve', 0.0),
|
|
|
|
));
|
2013-07-19 00:28:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|