Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

servicefailure.py: Revision history

From Randomness wiki

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

12 September 2024

9 September 2024

  • curprev 21:3421:34, 9 September 2024Derg talk contribs 1,055 bytes +1,055 Created page with "<syntaxhighlight lang="python"> #!/usr/bin/python3 import subprocess import requests import sys import os service = sys.argv[1] proc = subprocess.Popen("hostname", stdout=subprocess.PIPE, shell=True) hostname = proc.communicate()[0].decode("utf-8").strip() status = f"Service {service} failed on {hostname}" print(status) try: import redis r = redis.Redis() r.publish("boterrorlocal", status) except Exception as e: print(e) proc = subprocess.Popen(..."