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 1 commit
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
84 changes: 64 additions & 20 deletions cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,38 +234,82 @@
/**
* Start the daemon services.
*/
$app->command('start', function () {
DnsMasq::restart();

PhpFpm::restart();

Nginx::restart();
$app->command('start [service]', function ($service) {
switch($service) {
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
case '':
DnsMasq::restart();
PhpFpm::restart();
Nginx::restart();

info('Valet services have been started.');
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
return;
case 'dns-masq':
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
DnsMasq::restart();
info('dnsmasq has been started.');
return;
case 'nginx':
Nginx::restart();
info('Nginx has been started.');
return;
case 'php':
PhpFpm::restart();
info('PHP has been started.');
return;
}

info('Valet services have been started.');
return warning(sprintf('Invalid valet service name [%s]',$service));
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
})->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) {
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
case '':
DnsMasq::restart();
PhpFpm::restart();
Nginx::restart();

info('Valet services have been restarted.');
return;
case 'dns-masq':
DnsMasq::restart();
info('dnsmasq has been restarted.');
return;
case 'nginx':
Nginx::restart();
info('Nginx has been restarted.');
return;
case 'php':
PhpFpm::restart();
info('PHP has been restarted.');
return;
}

return warning(sprintf('Invalid valet service name [%s]',$service));
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
})->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) {
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
case '':
PhpFpm::stopRunning();
Nginx::stop();
info('Valet services have been stopped.');
return ;
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
case 'nginx':
Nginx::stop();
info('Nginx has been stopped.');
return;
case 'php':
PhpFpm::stop();
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
info('PHP has been stopped.');
return;
}

info('Valet services have been stopped.');
return warning(sprintf('Invalid valet service name [%s]',$service));
ahmedash95 marked this conversation as resolved.
Show resolved Hide resolved
})->descriptions('Stop the Valet services');

/**
Expand Down