From c7e305283e91ab82ca4a5039969209022b7387c0 Mon Sep 17 00:00:00 2001 From: The-Dark-Mode <167715404+The-Dark-Mode@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:34:00 +1300 Subject: [PATCH] Update README.md --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 06552bc..7bcd63a 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,48 @@ Modify config.json: ### Setup MQTT: Modify config.json: Change the IP, username, and password to match the user you have made for Home Assistant (or you can make a separate user for this script) + +### Configure the script to run on startup (DEBIAN/LINUX ONLY) +1. Install tmux +2. Create a script that starts the tmux session and runs python: +/home/user/startup.sh: +``` +#!/bin/bash + +# Start a new tmux session named 'emails' +tmux new-session -d -s emails + +# Send commands to the 'emails' session +tmux send-keys -t emails 'cd /opt/Frigate-SMTP' C-m +tmux send-keys -t emails 'python3 main.py' C-m +``` + +sudo chmod +x /home/user/startup.sh + +3. Create a systemctl service: + +/etc/systemd/system/frigate-smtp.service: +``` +[Unit] +Description=Frigate SMTP Service +After=network.target + +[Service] +Type=forking +ExecStart=/opt/Frigate-SMTP/startup.sh +WorkingDirectory=/opt/Frigate-SMTP +Restart=on-failure +User=root + +[Install] +WantedBy=multi-user.target +``` + +`sudo systemctl daemon-reload +sudo systemctl enable frigate-smtp.service +sudo systemctl start frigate-smtp.service` + +4. Verify it works: +`sudo systemctl status frigate-smtp.service` +OR +`tmux attach -t emails` (remember to exit safely by pressing CTRL+B then D)