Commit 32564437 authored by omega8cc's avatar omega8cc Committed by anarcat

Issue #1259098 - better support for different Nginx reload commands.

parent 01da2ef6
......@@ -52,7 +52,24 @@ class provisionService_http_nginx extends provisionService_http_public {
* service, even though it does not inherit this class.
*/
public static function nginx_restart_cmd() {
return 'sudo /etc/init.d/nginx reload';
$command = '/etc/init.d/nginx'; // A proper default for most of the world
$options[] = $command;
foreach (explode(':', $_SERVER['PATH']) as $path) {
$options[] = "$path/nginx";
}
// Try to detect the nginx restart command.
$options[] = '/usr/sbin/nginx -s';
$options[] = '/usr/local/sbin/nginx -s';
$options[] = '/usr/local/bin/nginx -s';
foreach ($options as $test) {
if (is_executable($test)) {
$command = $test;
break;
}
}
return "sudo $command reload";
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment