Created Systemd (markdown)

oooo-ps 2025-06-27 20:18:07 +03:00
parent 26f2505410
commit 4947ad0f0e

40
Systemd.md Normal file

@ -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