From 4947ad0f0e976579235734f60e3fa4ffbc747747 Mon Sep 17 00:00:00 2001 From: oooo-ps Date: Fri, 27 Jun 2025 20:18:07 +0300 Subject: [PATCH] Created Systemd (markdown) --- Systemd.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Systemd.md diff --git a/Systemd.md b/Systemd.md new file mode 100644 index 0000000..7efa4c4 --- /dev/null +++ b/Systemd.md @@ -0,0 +1,40 @@ +Run `nexy` as `systemd` service. + +## System user + +1. `useradd -m nexy` - create new system user with its home directory +2. `passwd nexy` - provide strong password +3. `su nexy` - login as `nexy` +4. `cd` - navigate to the home folder +5. `mkdir /home/nexy/public` - create location for the public fies + +## Service configuration + +Create new file `/etc/systemd/system/nexy.service` with following settings: + +``` snac.service +[Unit] +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=nexy +Group=nexy +ExecStartPre=/bin/sleep 10 +ExecStart=/usr/local/bin/nexy -p /home/nexy/public -b 0.0.0.0:1900 +StandardOutput=file:/home/nexy/debug.log +StandardError=file:/home/nexy/error.log + +[Install] +WantedBy=multi-user.target +``` +* replace `0.0.0.0:1900` with your address, use `[300:xxxx:xxxx:xxxx::1]:1900` notation for IPv6 +* bind (`-b`) as many interfaces as desired +* to disable debug output, set `StandardOutput` and `StandardError` as `null` or add `-d ''` option to `ExecStart` + +### Manage + +* `sudo systemctl daemon-reload` - apply new configuration +* `sudo systemctl enable nexy` - autostart on system startup +* `sudo systemctl restart nexy` - start the service \ No newline at end of file