Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow start/restart/stop single service #874

Merged
merged 3 commits into from
Jan 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
82 changes: 62 additions & 20 deletions cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,38 +234,80 @@
/**
* Start the daemon services.
*/
$app->command('start', function () {
DnsMasq::restart();

PhpFpm::restart();

Nginx::restart();
$app->command('start [service]', function ($service) {
switch ($service) {
case '':
DnsMasq::restart();
PhpFpm::restart();
Nginx::restart();

return info('Valet services have been started.');
case 'dnsmasq':
DnsMasq::restart();

return info('dnsmasq has been started.');
case 'nginx':
Nginx::restart();

return info('Nginx has been started.');
case 'php':
PhpFpm::restart();

return info('PHP has been started.');
}

info('Valet services have been started.');
return warning(sprintf('Invalid valet service name [%s]', $service));
})->descriptions('Start the Valet services');

/**
* Restart the daemon services.
*/
$app->command('restart', function () {
DnsMasq::restart();

PhpFpm::restart();

Nginx::restart();

info('Valet services have been restarted.');
$app->command('restart [service]', function ($service) {
switch ($service) {
case '':
DnsMasq::restart();
PhpFpm::restart();
Nginx::restart();

return info('Valet services have been restarted.');
case 'dnsmasq':
DnsMasq::restart();

return info('dnsmasq has been restarted.');
case 'nginx':
Nginx::restart();

return info('Nginx has been restarted.');
case 'php':
PhpFpm::restart();

return info('PHP has been restarted.');
}

return warning(sprintf('Invalid valet service name [%s]', $service));
})->descriptions('Restart the Valet services');

/**
* Stop the daemon services.
*/
$app->command('stop', function () {
PhpFpm::stopRunning();

Nginx::stop();
$app->command('stop [service]', function ($service) {
switch ($service) {
case '':
PhpFpm::stopRunning();
Nginx::stop();

return info('Valet services have been stopped.');
case 'nginx':
Nginx::stop();

return info('Nginx has been stopped.');
case 'php':
PhpFpm::stopRunning();

return info('PHP has been stopped.');
}

info('Valet services have been stopped.');
return warning(sprintf('Invalid valet service name [%s]', $service));
})->descriptions('Stop the Valet services');

/**
Expand Down