2023-10-04 21:55:18 -04:00
# Systemd Setup For Backend Tools
2021-09-21 15:17:05 -04:00
2023-10-04 21:55:18 -04:00
- **You will need to fill in the proper username below in the paths marked `<run_as_user>` .**
- **This assumes you have installed lndg on the home directory of the user. For example, user `mynode` will have a home directory of `/home/mynode/` .**
2021-09-21 15:17:05 -04:00
2023-10-04 21:55:18 -04:00
## Backend Controller Setup
Create a service file for `controller.py` , copying the contents below to the file and filling in the user you would like this to run under.
2023-10-26 14:46:09 -04:00
`nano /etc/systemd/system/lndg-controller.service`
2021-09-21 15:17:05 -04:00
```
[Unit]
2023-10-04 21:55:18 -04:00
Description=Backend Controller For Lndg
2021-09-21 15:17:05 -04:00
[Service]
2023-10-04 21:55:18 -04:00
Environment=PYTHONUNBUFFERED=1
2021-09-21 15:17:05 -04:00
User=< run_as_user >
Group=< run_as_user >
2026-06-22 16:19:32 +02:00
WorkingDirectory=/home/< run_as_user > /lndg
2023-10-04 21:55:18 -04:00
ExecStart=/home/< run_as_user > /lndg/.venv/bin/python /home/< run_as_user > /lndg/controller.py
2026-06-22 16:19:32 +02:00
StandardOutput=journal
StandardError=journal
2022-09-23 10:29:23 -04:00
Restart=always
2022-01-21 11:43:37 -05:00
RestartSec=60s
2022-01-21 20:50:34 -05:00
[Install]
WantedBy=multi-user.target
2021-12-23 08:46:48 -05:00
```
2023-10-04 21:55:18 -04:00
Enable and start the service to run the backend controller.
2023-10-26 14:46:09 -04:00
`sudo systemctl enable lndg-controller.service`
`sudo systemctl start lndg-controller.service`
2021-12-23 08:46:48 -05:00
2023-10-04 21:55:18 -04:00
## Additional Commands
You can also check on the status, disable or stop the backend controller.
2023-10-26 14:46:09 -04:00
`sudo systemctl status lndg-controller.service`
`sudo systemctl disable lndg-controller.service`
`sudo systemctl stop lndg-controller.service`