Skip to content

Commit

Permalink
Merge pull request #874 from ahmedash95/patch-1
Browse files Browse the repository at this point in the history
Allow start/restart/stop single service
  • Loading branch information
mattstauffer committed Jan 6, 2020
2 parents a0df274 + 924feb1 commit 4b76778
Showing 1 changed file with 62 additions and 20 deletions.
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

0 comments on commit 4b76778

Please sign in to comment.