From e9a3eda164af5950a4361bdbc82bc08c41e543a3 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 6 Apr 2026 23:18:38 +0300 Subject: [PATCH] add systemd example, minor corrections --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a80ed0d..4188b78 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # ytd -YouTube daemon for crawling and processing channels with pre-configured commands +YouTube daemon and CLI tool for crawling and processing channels with pre-configured commands vector. -* this tool initially created as a tool for the [Pidpilne](https://codeberg.org/YGGverse/pidpilne) project. +_This tool initially created as a tool for the [Pidpilne](https://codeberg.org/YGGverse/pidpilne) project._ ## Install @@ -22,4 +22,45 @@ Background / daemon: ``` bash RUST_LOG=ytd=warn NO_COLOR=1 /usr/local/bin/ytd -c /etc/config.toml -``` \ No newline at end of file +``` + +### systemd + +``` bash +git clone https://codeberg.org/yggverse/ytd.git +cd ytd +cargo build --release --locked +sudo install target/release/ytd /usr/local/bin +sudo cp example/config.toml /etc/ytd.toml +sudo useradd -s /usr/sbin/nologin -Mr ytd +sudo mkdir /var/lib/ytd && sudo chown ytd:ytd /var/lib/ytd +sudo mkdir /var/log/ytd && sudo chown ytd:ytd /var/log/ytd +``` + +``` /etc/systemd/system/ytd.service +#/etc/systemd/system/ytd.service + +[Unit] +After=network-online.target +Wants=network-online.target + +[Service] +User=ytd +Group=ytd + +Environment="RUST_LOG=ytd=warn" +Environment="NO_COLOR=1" +WorkingDirectory=/var/lib/ytd +ExecStart=/usr/local/bin/ytd -c=/etc/ytd.toml + +Restart=always + +StandardOutput=file:///var/log/ytd/debug.log +StandardError=file:///var/log/ytd/error.log + +[Install] +WantedBy=multi-user.target +``` +* `sudo systemctl restart ytd` +* `sudo systemctl enable ytd` +* `sudo systemctl status ytd`