<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.randomness.nu/mediawiki/index.php?action=history&amp;feed=atom&amp;title=servicefailure.py</id>
	<title>servicefailure.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.randomness.nu/mediawiki/index.php?action=history&amp;feed=atom&amp;title=servicefailure.py"/>
	<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=servicefailure.py&amp;action=history"/>
	<updated>2026-05-14T13:22:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.randomness.nu/mediawiki/index.php?title=servicefailure.py&amp;diff=62&amp;oldid=prev</id>
		<title>Derg: Derg moved page Servicefailure.py to servicefailure.py without leaving a redirect: Misspelled title</title>
		<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=servicefailure.py&amp;diff=62&amp;oldid=prev"/>
		<updated>2024-09-12T12:49:31Z</updated>

		<summary type="html">&lt;p&gt;Derg moved page &lt;a href=&quot;/mediawiki/index.php?title=Servicefailure.py&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Servicefailure.py (page does not exist)&quot;&gt;Servicefailure.py&lt;/a&gt; to &lt;a href=&quot;/servicefailure.py&quot; title=&quot;servicefailure.py&quot;&gt;servicefailure.py&lt;/a&gt; without leaving a redirect: Misspelled title&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:49, 12 September 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Derg</name></author>
	</entry>
	<entry>
		<id>https://wiki.randomness.nu/mediawiki/index.php?title=servicefailure.py&amp;diff=9&amp;oldid=prev</id>
		<title>Derg: Created page with &quot;&lt;syntaxhighlight lang=&quot;python&quot;&gt; #!/usr/bin/python3 import subprocess import requests import sys import os   service = sys.argv[1] proc = subprocess.Popen(&quot;hostname&quot;, stdout=subprocess.PIPE, shell=True) hostname = proc.communicate()[0].decode(&quot;utf-8&quot;).strip() status = f&quot;Service {service} failed on {hostname}&quot; print(status)  try:     import redis      r = redis.Redis()     r.publish(&quot;boterrorlocal&quot;, status) except Exception as e:     print(e)  proc = subprocess.Popen(...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.randomness.nu/mediawiki/index.php?title=servicefailure.py&amp;diff=9&amp;oldid=prev"/>
		<updated>2024-09-09T19:34:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt; #!/usr/bin/python3 import subprocess import requests import sys import os   service = sys.argv[1] proc = subprocess.Popen(&amp;quot;hostname&amp;quot;, stdout=subprocess.PIPE, shell=True) hostname = proc.communicate()[0].decode(&amp;quot;utf-8&amp;quot;).strip() status = f&amp;quot;Service {service} failed on {hostname}&amp;quot; print(status)  try:     import redis      r = redis.Redis()     r.publish(&amp;quot;boterrorlocal&amp;quot;, status) except Exception as e:     print(e)  proc = subprocess.Popen(...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/python3&lt;br /&gt;
import subprocess&lt;br /&gt;
import requests&lt;br /&gt;
import sys&lt;br /&gt;
import os&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
service = sys.argv[1]&lt;br /&gt;
proc = subprocess.Popen(&amp;quot;hostname&amp;quot;, stdout=subprocess.PIPE, shell=True)&lt;br /&gt;
hostname = proc.communicate()[0].decode(&amp;quot;utf-8&amp;quot;).strip()&lt;br /&gt;
status = f&amp;quot;Service {service} failed on {hostname}&amp;quot;&lt;br /&gt;
print(status)&lt;br /&gt;
&lt;br /&gt;
try:&lt;br /&gt;
    import redis&lt;br /&gt;
&lt;br /&gt;
    r = redis.Redis()&lt;br /&gt;
    r.publish(&amp;quot;boterrorlocal&amp;quot;, status)&lt;br /&gt;
except Exception as e:&lt;br /&gt;
    print(e)&lt;br /&gt;
&lt;br /&gt;
proc = subprocess.Popen(&lt;br /&gt;
    f&amp;quot;systemctl --user -M pi@ status {service}&amp;quot;, stdout=subprocess.PIPE, shell=True&lt;br /&gt;
)&lt;br /&gt;
output = proc.communicate()[0].decode(&amp;quot;utf-8&amp;quot;).strip()&lt;br /&gt;
&lt;br /&gt;
logo = &amp;quot;https://cdn.discordapp.com/attachments/1170631155905744896/1175721829906788472/systemd-logomark.png&amp;quot;&lt;br /&gt;
user = &amp;quot;systemd&amp;quot;&lt;br /&gt;
&lt;br /&gt;
hook = &amp;quot;https://discord.com/api/webhooks/1175604004059877426/[REDACTED]&amp;quot;&lt;br /&gt;
color = 0xFF0000&lt;br /&gt;
o = dict(&lt;br /&gt;
    embeds=[dict(color=color, title=status, description=f&amp;quot;```rb\n{output}\n```&amp;quot;)],&lt;br /&gt;
    username=user,&lt;br /&gt;
    avatar_url=logo,&lt;br /&gt;
)&lt;br /&gt;
d = requests.post(hook, params=dict(wait=&amp;quot;true&amp;quot;), json=o)&lt;br /&gt;
print(d.text)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Derg</name></author>
	</entry>
</feed>