lndg/systemd.md

34 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

# Systemd Setup For Backend Tools
2021-09-21 15:17:05 -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
## 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.
`nano /etc/systemd/system/lndg-controller.service`
2021-09-21 15:17:05 -04:00
```
[Unit]
Description=Backend Controller For Lndg
2021-09-21 15:17:05 -04:00
[Service]
Environment=PYTHONUNBUFFERED=1
2021-09-21 15:17:05 -04:00
User=<run_as_user>
Group=<run_as_user>
WorkingDirectory=/home/<run_as_user>/lndg
ExecStart=/home/<run_as_user>/lndg/.venv/bin/python /home/<run_as_user>/lndg/controller.py
StandardOutput=journal
StandardError=journal
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
```
Enable and start the service to run the backend controller.
`sudo systemctl enable lndg-controller.service`
`sudo systemctl start lndg-controller.service`
2021-12-23 08:46:48 -05:00
## Additional Commands
You can also check on the status, disable or stop the backend controller.
`sudo systemctl status lndg-controller.service`
`sudo systemctl disable lndg-controller.service`
`sudo systemctl stop lndg-controller.service`