1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 17:52:43 +01:00
phorge-phorge/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php

55 lines
1.5 KiB
PHP
Raw Normal View History

<?php
final class PhabricatorDaemonManagementRestartWorkflow
extends PhabricatorDaemonManagementWorkflow {
protected function didConstruct() {
$this
->setName('restart')
->setSynopsis(pht('Stop, then start the standard daemon loadout.'))
->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,
),
array(
'name' => 'gently',
'help' => pht(
'Ignore running processes that look like daemons but do not '.
'have corresponding PID files.'),
),
phd - make stop / restart savvy to daemons without pid files Summary: Ref T2374. This currently doesn't work in that while the daemons are stopped, they are restarted. How do I stop them for good? (If it worked I'd also give it a little pass for variable names, etc quality stuff) Test Plan: ``` 14:09:20 ~/Dropbox/code/phalanx (T2374) ~> sudo ./bin/phd restart There are no running Phabricator daemons. Freeing active task leases... Freed 0 task lease(s). Preparing to launch daemons. NOTE: Logs will appear in '/var/tmp/phd/log/daemons.log'. Launching daemon "PhabricatorRepositoryPullLocalDaemon". Launching daemon "PhabricatorGarbageCollectorDaemon". Launching daemon "PhabricatorTaskmasterDaemon". Launching daemon "PhabricatorTaskmasterDaemon". Launching daemon "PhabricatorTaskmasterDaemon". Launching daemon "PhabricatorTaskmasterDaemon". Done. 14:09:30 ~/Dropbox/code/phalanx (T2374) ~> rm -rf /var/tmp/phd/pid/* 14:09:42 ~/Dropbox/code/phalanx (T2374) ~> sudo ./bin/phd stop There are no running Phabricator daemons. There are processes running that look like Phabricator daemons but have no corresponding PID files: php /Users/btrahan/Dropbox/code/libphutil/scripts/daemon/exec/exec_daemon.php PhabricatorRepositoryPullLocalDaemon --load-phutil-library=/Users/btrahan/Dropbox/code/arcanist/src --load-phutil-library=/Users/btrahan/Dropbox/code/phalanx/src --log=/var/tmp/phd/log/daemons.log -- php /Users/btrahan/Dropbox/code/libphutil/scripts/daemon/exec/exec_daemon.php PhabricatorGarbageCollectorDaemon --load-phutil-library=/Users/btrahan/Dropbox/code/arcanist/src --load-phutil-library=/Users/btrahan/Dropbox/code/phalanx/src --log=/var/tmp/phd/log/daemons.log -- php /Users/btrahan/Dropbox/code/libphutil/scripts/daemon/exec/exec_daemon.php PhabricatorTaskmasterDaemon --load-phutil-library=/Users/btrahan/Dropbox/code/arcanist/src --load-phutil-library=/Users/btrahan/Dropbox/code/phalanx/src --log=/var/tmp/phd/log/daemons.log -- php /Users/btrahan/Dropbox/code/libphutil/scripts/daemon/exec/exec_daemon.php PhabricatorTaskmasterDaemon --load-phutil-library=/Users/btrahan/Dropbox/code/arcanist/src --load-phutil-library=/Users/btrahan/Dropbox/code/phalanx/src --log=/var/tmp/phd/log/daemons.log -- php /Users/btrahan/Dropbox/code/libphutil/scripts/daemon/exec/exec_daemon.php PhabricatorTaskmasterDaemon --load-phutil-library=/Users/btrahan/Dropbox/code/arcanist/src --load-phutil-library=/Users/btrahan/Dropbox/code/phalanx/src --log=/var/tmp/phd/log/daemons.log -- php /Users/btrahan/Dropbox/code/libphutil/scripts/daemon/exec/exec_daemon.php PhabricatorTaskmasterDaemon --load-phutil-library=/Users/btrahan/Dropbox/code/arcanist/src --load-phutil-library=/Users/btrahan/Dropbox/code/phalanx/src --log=/var/tmp/phd/log/daemons.log -- php /Users/btrahan/Dropbox/code/phalanx/scripts/daemon/phd-daemon PhabricatorRepositoryPullLocalDaemon --daemonize --log=/var/tmp/phd/log/daemons.log --phd=/var/tmp/phd/pid php /Users/btrahan/Dropbox/code/phalanx/scripts/daemon/phd-daemon PhabricatorGarbageCollectorDaemon --daemonize --log=/var/tmp/phd/log/daemons.log --phd=/var/tmp/phd/pid php /Users/btrahan/Dropbox/code/phalanx/scripts/daemon/phd-daemon PhabricatorTaskmasterDaemon --daemonize --log=/var/tmp/phd/log/daemons.log --phd=/var/tmp/phd/pid php /Users/btrahan/Dropbox/code/phalanx/scripts/daemon/phd-daemon PhabricatorTaskmasterDaemon --daemonize --log=/var/tmp/phd/log/daemons.log --phd=/var/tmp/phd/pid php /Users/btrahan/Dropbox/code/phalanx/scripts/daemon/phd-daemon PhabricatorTaskmasterDaemon --daemonize --log=/var/tmp/phd/log/daemons.log --phd=/var/tmp/phd/pid php /Users/btrahan/Dropbox/code/phalanx/scripts/daemon/phd-daemon PhabricatorTaskmasterDaemon --daemonize --log=/var/tmp/phd/log/daemons.log --phd=/var/tmp/phd/pid Stop these processes by re-running this command with the --force parameter. 14:09:47 ~/Dropbox/code/phalanx (T2374) ~> sudo ./bin/phd stop --force Interrupting daemon 'Rogue daemon' (66167)... Interrupting daemon 'Rogue daemon' (66174)... Interrupting daemon 'Rogue daemon' (66177)... Interrupting daemon 'Rogue daemon' (66191)... Interrupting daemon 'Rogue daemon' (66193)... Interrupting daemon 'Rogue daemon' (66196)... Interrupting daemon 'Rogue overseer' (66166)... Interrupting daemon 'Rogue overseer' (66169)... Interrupting daemon 'Rogue overseer' (66175)... Interrupting daemon 'Rogue overseer' (66189)... Interrupting daemon 'Rogue overseer' (66192)... Interrupting daemon 'Rogue overseer' (66195)... Daemon 66167 exited. Daemon 66174 exited. Daemon 66177 exited. Daemon 66191 exited. Daemon 66193 exited. Daemon 66196 exited. Daemon 66166 exited. Daemon 66169 exited. Daemon 66175 exited. Daemon 66189 exited. Daemon 66192 exited. Daemon 66195 exited. ``` Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T2374 Differential Revision: https://secure.phabricator.com/D10354
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.'),
),
$this->getAutoscaleReserveArgument(),
));
}
public function execute(PhutilArgumentParser $args) {
$err = $this->executeStopCommand(
array(),
array(
'graceful' => $args->getArg('graceful'),
'force' => $args->getArg('force'),
'gently' => $args->getArg('gently'),
));
if ($err) {
return $err;
}
return $this->executeStartCommand(
array(
'reserve' => (float)$args->getArg('autoscale-reserve', 0.0),
));
}
}