From 1a3e6bb104eeb6330b0efb75b546ca6b48e54771 Mon Sep 17 00:00:00 2001 From: nex Date: Tue, 18 Apr 2023 16:58:18 +0100 Subject: [PATCH] Add comments to the sample service file --- cogs/other.py | 1 + college-bot.service | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cogs/other.py b/cogs/other.py index 4bffb3a..7579373 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -632,6 +632,7 @@ class OtherCog(commands.Cog): async def dns_check() -> Optional[bool | str]: try: + # noinspection PyTypeChecker for response in await asyncio.to_thread(dns.resolver.resolve, url.hostname, "A"): if response.address == "0.0.0.0": return "DNS blacklist" diff --git a/college-bot.service b/college-bot.service index bb033c2..689f52e 100644 --- a/college-bot.service +++ b/college-bot.service @@ -4,17 +4,26 @@ StartLimitBurst=10 # If we're still failing after 10 attempts, something is wrong. Wants=network-online.target After=network.target network-online.target +# Wait until a network connection is established [Service] Type=simple RemainAfterExit=no ExecStart=/home/nex/jimmy/venv/bin/python3 /home/nex/jimmy/main.py +# Change the path to where your binaries are + Restart=always RestartSec=5 -# Wait 5 seconds before restarts +# Wait 5 seconds before restarts. + User=nex +# Change `nex` to whatever user to run as (NOT root, for the love of god don't run my software as root unless +# the program specifically asks for it) + MemoryMax=1024M CPUQuota=50% +# Realistically, the bot will never need more than a gigabyte of RAM and half a CPU core. +# However, some features (namely /screenshot) can use an uncontrollable amount of resources (e.g. a browser). # Security so that people like @Mcharlsto can't delete my system "by accident" PrivateTmp=true