Execute nginx exe in folder with -s reload args Consul template Windows -
i using consul template v0.19.0 for windows, rendering nginx loadbalancing config.it working expected.
now want consul template, execute nginx exe in folder args (-s reload) below:-
case 1:
template { source = "template/template.ctmpl" destination = "f:\\ide\\visual studio collection\\web servers\\nginx- 1.12.0\\nginx-1.12.0\\conf\\nginx.conf" command = "f:\\ide\\visual studio collection\\web servers\\nginx- 1.12.0\\nginx-1.12.0\\nginx -s reload" command_timeout = "60s" }
but throws error like, "failed execute command "f:\ide\visual studio collection\web servers\nginx-1.12.0\nginx-1.12.0\nginx.exe" "template/template.ctmpl" => "f:\ide\visual studio collection\web servers\nginx-1.12.0\nginx-1.12.0\conf\nginx.conf": child: exec: "f:idevisual": file not exist".
case 2:- have achieved making nginx service (using nssm) , gave command like,
command = "powershell restart-service nginx"
instead of giving full path followed "-s reload".
but this, have make nginx service using apps nssm.
may know, there way tell command attribute in consul template config to, "execute nginx exe in folder in case 1" ?
thanks.
try this
template { source = "template/template.ctmpl" destination = "f:\\ide\\visual studio collection\\web servers\\nginx- 1.12.0\\nginx-1.12.0\\conf\\nginx.conf" command = "\"f:\\ide\\visual studio collection\\web servers\\nginx- 1.12.0\\nginx-1.12.0\\nginx\" -s reload" command_timeout = "60s" }
if doesn't work try below options command
command = "\"f:/ide/visual studio collection/web servers/nginx- 1.12.0/nginx-1.12.0/nginx\" -s reload"
or
command = "\"f:\\\\ide\\\\visual studio collection\\\\web servers\\\\nginx- 1.12.0\\\\nginx-1.12.0\\\\nginx\" -s reload"
edit-1
so based on discussion, seems nginx config has relative folder based config. when nginx started folder, needs reloaded same folder. need changed folder , execute reload command. 2 formats should try are
command="cd '<nginx folder path>' && nginx -s reload"
or
command="cmd /k 'cd \'<nginx folder path>\' && nginx -s reload'"
Comments
Post a Comment