From f00aa189e3942183bb637921db67b9a6d0a0819b Mon Sep 17 00:00:00 2001 From: krau <71133316+krau@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:01:16 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=20systemd=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=85=8D=E7=BD=AE=E8=AF=B4=E6=98=8E=E5=88=B0?= =?UTF-8?q?=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 0d24b95..3b03132 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,31 @@ chmod +x saveany-bot ./saveany-bot ``` +### 添加为 systemd 服务 + +创建文件 `/etc/systemd/system/saveany-bot.service` 并写入以下内容: + +``` +[Unit] +Description=SaveAnyBot +After=systemd-user-sessions.service + +[Service] +Type=simple +WorkingDirectory=/yourpath/ +ExecStart=/yourpath/saveany-bot +Restart=on-failure + +[Install] +WantedBy=multi-user.target +``` + +设为开机启动并启动服务: + +```bash +systemctl enable --now saveany-bot +``` + ## 更新 使用 `upgrade` 或 `up` 升级到最新版