fix to handle stale pids (whem VM reboots) from arc watcher thread
* fix to handle stale pids (whem VM reboots) from arc watcher thread
fix to handle stale pids (whem VM reboots) from arc watcher thread
* Update agent.py
* Update agent.py
@@ -803,12 +803,13 @@ def stop_arc_watcher():
pids_filepath = os.path.join(os.getcwd(),'amaarc.pid')
# kill existing arc watcher
+
if os.path.exists(pids_filepath):
with open(pids_filepath, "r") as f:
for pids in f.readlines():
proc = subprocess.Popen(["ps -o cmd= {0}".format(pids)], stdout=subprocess.PIPE, shell=True)
output = proc.communicate()[0]
- if "arc" in output:
+ if output and "arc" in output:
kill_cmd = "kill " + pids
run_command_and_log(kill_cmd)
