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

Systemd

From Nest Guides
Revision as of 22:27, 23 August 2024 by Samuel (talk | contribs) (Fix a couple formatting and clarity issues)

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=
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 <name>, and systemctl --user start <name>. 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 <name>. Your service should now be running!

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