Systemd

From Nest Guides

If you want your apps to be integrated in the background with the system and start up when the system starts up, then you'll want to put your service with Systemd! Systemd is a system and service manager that runs as PID 1 and starts the rest of the system. It's used on most Linux distributions, including Debian, which Nest runs on!

Systemd is primarily used for starting the system itself, and these services are only accessible to the root user. However, it also works for users, with the --user flag when running any systemd command. Since Nest users don't have access to the root user, you'll need to remember to always use the --user flag.

To get started, you need to create a systemd service file in the ~/.config/systemd/user/ directory. This file should be setup as follows:

[Unit]
Description=
DefaultDependencies=no
After=network-online.target

[Service]
Type=oneshot
ExecStart=
TimeoutStartSec=0

[Install]
WantedBy=default.target

Description is the title of the systemd service. ExecStart should be set to the path of the executable the service will be running. After and WantedBy in this setup configure the service to run every time nest starts. Once you are done editing the configuration, save it and then run systemctl --user daemon-reload, systemctl --user enable SERVICE-NAME.service, and systemctl --user start SERVICE-NAME.service. This last command may appear to freeze. That is okay. Press CTRL + C and then check the status of the service with systemctl --user status SERVICE-NAME.service. Your service should now be running. For more info, take a look at https://linuxhandbook.com/create-systemd-services/