Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

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, named <name>.service (with name being the name of your app). This file should be setup as follows:

[Unit]
Description=

[Service]
ExecStart=

[Install]
WantedBy=default.target
  • Description is the title of the systemd service.
  • ExecStart should be the command the service runs.

Once you are done editing the configuration, save it and then run systemctl --user daemon-reload to load the new configuration. Finally, run systemctl --user enable --now <name>, which will "enable" your service (so that it starts when Nest starts), and also start it up .This command may appear to freeze. That is okay. Press CTRL + C and then check the status of the service with systemctl --user status <name>. Your service should now be running!

For more info, take a look at https://linuxhandbook.com/create-systemd-services/.

More commands

These are all the basic commands that you can use to manage your Systemd services:

systemctl --user status <name>: see status and recent logs of a service

journalctl --user -xeu <name>: see all logs of a service

systemctl --user start <name>: starts the service

systemctl --user stop <name>: stops the service

systemctl --user enable <name>: enables (makes it start when Nest starts) the service. Optionally takes a --now argument to start it as well.

systemctl --user disable <name>: disables (makes it not start when Nest starts) the service. Optionally takes a --now argument to stop it as well.