From 7ae85f73c81acde9194dcf9fba43091544ed3c25 Mon Sep 17 00:00:00 2001 From: Myned Date: Mon, 6 Mar 2023 21:45:09 -0600 Subject: [PATCH] Update readme --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cdb26c6..4e4b8c8 100644 --- a/README.md +++ b/README.md @@ -4,31 +4,31 @@ An experimental [Hikari](https://www.hikari-py.dev) Discord bot for assigning ac [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/B0B1AUB66) ## Prerequisites -A Unix-based operating system is used for the following commands\ +Linux is used for the following commands\ [WSL](https://docs.microsoft.com/en-us/windows/wsl) can be used to run Linux on Windows, but is not required to run the bot ## Requirements [Git](https://git-scm.com/downloads)\ [Python](https://www.python.org) 3.10+\ [Poetry](https://python-poetry.org/docs/master) ## Installing -Clone this repository +1. Clone repository ``` git clone https://github.com/Myned/Watcher.git ``` -Go to the project folder +2. Go to project folder ``` cd Watcher ``` -Create a virtual environment and install dependencies +3. Create a virtual environment and install dependencies ``` poetry install ``` ## Usage -Go to the project folder +1. Go to project folder ``` cd Watcher ``` -Run with optimizations +2. Run with optimizations ``` poetry run python -OO run.py ``` @@ -45,21 +45,57 @@ active = 0 # active role id inactive = 0 # inactive role id duration = 0 # time in seconds before considered inactive ``` -## Updating -Go to the project folder +### systemd service +Run in the background on most Linux machines\ +This assumes that the project folder is located at `~/.git/Watcher`\ +Change the `WorkingDirectory` path in `watcher.service` if this is not the case +1. Go to project folder ``` cd Watcher ``` -Pull changes from the repository +2. Copy user service file +``` +cp watcher.service ~/.config/systemd/user +``` +3. Reload user daemon +``` +systemctl --user daemon-reload +``` +4. Start and enable service on login +``` +systemctl --user enable --now watcher +``` +5. Enable lingering to start user services on boot +``` +sudo loginctl enable-linger username +``` +## Updating +1. Go to project folder +``` +cd Watcher +``` +2. Pull changes from repository ``` git pull ``` -Update the virtual environment +3. Update virtual environment ``` poetry update ``` ## Uninstalling -Remove the project folder +1. Stop and disable systemd user service +``` +systemctl --user disable --now watcher +``` +2. Remove systemd user service file +``` +rm ~/.config/systemd/user/watcher.service +``` +3. Optionally disable lingering +``` +sudo loginctl disable-linger username +``` +4. Remove project folder ``` rm -rf Watcher ```