Skip to content

Commit

Permalink
Send SIGKILL to rsyslog if hard cancellation is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealHaoLiu committed Dec 12, 2023
1 parent 26294f8 commit 9764f38
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/scripts/rsyslog-4xx-recovery
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def write_stdout(s):
sys.stdout.flush()

def write_stderr(s):
sys.stderr.write(s)
sys.stderr.write(f"[rsyslog-4xx-recovery] {s}")
sys.stderr.flush()

def main():
Expand Down Expand Up @@ -47,6 +47,15 @@ def main():
except Exception as e:
write_stderr(str(e))

if "action-0-omhttp queue: need to do hard cancellation" in log_message:
try:
write_stderr(
f"{datetime.datetime.now(timezone.utc)} - sending SIGKILL to proc=[{proc_details['processname']}] with pid=[{int(proc_details['pid'])}] due to log_message=[{log_message}]\n"
)
os.kill(int(proc_details["pid"]), signal.SIGKILL)
except Exception as e:
write_stderr(str(e))

write_stdout("RESULT 2\nOK")


Expand Down

0 comments on commit 9764f38

Please sign in to comment.