Not death by midges?uudon wrote:I wish they would add this back into the game, thorn in the foot was quite possibly the funniest way to die.Hasta wrote:Won't bother to make clogs, inevitably step on a splinter and perish of the infected wound.
-
landreaum
- Posts: 59
- Joined: Sat Sep 17, 2022 7:27 pm
Re: Server Status Thread
-
Borg_2
- Posts: 4
- Joined: Wed Sep 07, 2011 1:00 am
Re: Server Status Thread
Fan of death by picking up a hedgehog myself.landreaum wrote: Not death by midges?
-
loftar
- Posts: 9092
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Server Status Thread
Oh my, I'm terribly sorry for the delay. Apparently my alarm didn't work for whatever reason, and of course it crashed like the actual second I went to sleep. Trying to debug now.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
HamsterBBT
- Posts: 15
- Joined: Tue Dec 28, 2021 9:08 am
Re: Server Status Thread
All silk production will dead ? @loftar
-
meus
- Posts: 212
- Joined: Sun Sep 04, 2011 3:00 pm
Re: Server Status Thread
Silk should be fine - seems that all timers are stopped while servers are down, so don't worry 


-
TheServant
- Posts: 616
- Joined: Wed Apr 09, 2014 1:07 am
Re: Server Status Thread
You need a better alarm, we are using this one to see when it's back.loftar wrote:Oh my, I'm terribly sorry for the delay. Apparently my alarm didn't work for whatever reason, and of course it crashed like the actual second I went to sleep. Trying to debug now.
Code: Select all
import requests
from bs4 import BeautifulSoup
import time
import pygame
# Initialize pygame
pygame.mixer.init()
# Main loop to check the webpage and play the sound
while True:
try:
response = requests.get('https://www.havenandhearth.com/portal/')
soup = BeautifulSoup(response.text, 'html.parser')
status_div = soup.find('div', {'id': 'status'})
if status_div and status_div.find('h2') and 'The server is up' in status_div.find('h2').text:
print("Alarm: The server is up.")
pygame.mixer.music.load(r'$path')
pygame.mixer.music.play()
else:
print("The server might not be up or the status couldn't be found.")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
time.sleep(60) # Sleep for 60 seconds (1 minute) before the next request
"Occasionally I drop a teacup to shatter on the floor. On purpose. I'm not satisfied when it doesn't gather itself up again. Someday perhaps, a cup will come together."
-
loftar
- Posts: 9092
- Joined: Fri Apr 03, 2009 7:05 am
- Location: Your character database
Re: Server Status Thread
Probably, but I think you do too. Previously, I've just been grepping the syslog over SSH, but now I wrote this which should hopefully be a bit more robust:TheServant wrote:You need a better alarm
Code: Select all
#!/usr/bin/python3
import sys, os, urllib.request, time
url = "http://www.havenandhearth.com/mt/srv-mon"
spath = os.path.join(os.getenv("HOME"), "audio/sounds/takeya.wav")
while True:
try:
with urllib.request.urlopen(url) as s:
while ln := s.readline():
words = ln.decode("ascii").split()
if len(words) == 0:
sys.stderr.write("haven-alarm: connected\n")
continue
if words[0] == "state" and words[1] == "crashed":
os.system("play -q " + spath)
except urllib.error.URLError as exc:
sys.stderr.write("haven-alarm: warning: could not connect: %s\n" % exc)
time.sleep(60)
sys.stderr.write("haven-alarm: reconnecting\n")
continue
"Object-oriented design is the roman numerals of computing." -- Rob Pike
-
Hubiektyw
- Posts: 20
- Joined: Sat Jan 07, 2017 5:19 pm
- Location: Venore