From a8b401befdf0c48b1dca42dc124ea9d9011bfa3c Mon Sep 17 00:00:00 2001 From: Nitin Ravindran Date: Mon, 15 May 2017 18:56:56 -0400 Subject: [PATCH] Clear the consul agent PID file to allow for restart of the agent Signed-off-by: Slawek Ligus --- jobs/consul_agent_windows/templates/pre-start.ps1.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jobs/consul_agent_windows/templates/pre-start.ps1.erb b/jobs/consul_agent_windows/templates/pre-start.ps1.erb index 5a73145..e6caa9b 100644 --- a/jobs/consul_agent_windows/templates/pre-start.ps1.erb +++ b/jobs/consul_agent_windows/templates/pre-start.ps1.erb @@ -34,6 +34,12 @@ function ReleaseDNSLock() { Remove-Item C:\var\vcap\sys\run\consul-dns.lock -ErrorAction Ignore } +function ClearConsulAgentPidfile() { + Remove-Item C:\var\vcap\sys\log\consul_agent_windows\consul_agent.pid -ErrorAction Ignore +} + +ClearConsulAgentPidfile + WaitForDNSLock [array]$routeable_interfaces = Get-WmiObject Win32_NetworkAdapterConfiguration | Where { $_.IpAddress -AND ($_.IpAddress | Where { $addr = [Net.IPAddress] $_; $addr.AddressFamily -eq "InterNetwork" -AND ($addr.address -BAND ([Net.IPAddress] "255.255.0.0").address) -ne ([Net.IPAddress] "169.254.0.0").address }) }