publish eve_orehold_watcher.py
This commit is contained in:
parent
5beca84cde
commit
d354ae1565
1 changed files with 3 additions and 14 deletions
|
|
@ -56,24 +56,13 @@ CONFIG_PATH = os.path.join(HERE, "config.ini")
|
||||||
|
|
||||||
|
|
||||||
def heartbeat(cp, source):
|
def heartbeat(cp, source):
|
||||||
"""Post a one-line 'watcher online' to Discord so installs are verifiable at a
|
"""Show 'watcher online' by EDITING one message per source (no spam on restart).
|
||||||
glance. Deduped to at most once per 6h per source to avoid restart spam."""
|
Defined here so every watcher (all import this module) shares it."""
|
||||||
marker = os.path.join(HERE, f".hb_{source}")
|
|
||||||
try:
|
|
||||||
if os.path.exists(marker) and time.time() - os.path.getmtime(marker) < 6 * 3600:
|
|
||||||
return
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
except Exception:
|
except Exception:
|
||||||
host = "PC"
|
host = "PC"
|
||||||
_discord(cp, "🟢 Watcher online", f"`{source}` running on **{host}**.")
|
_discord_live(cp, f"hb_{source}", "🟢 Watcher online", f"`{source}` on **{host}**")
|
||||||
try:
|
|
||||||
with open(marker, "w") as f:
|
|
||||||
f.write(str(int(time.time())))
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue