Posts tagged with “systemd”

Running a systemd service as a regular user

A "note to self" post on how to create a systemd service and run it a regular user.

Assuming, you're logged in as a regular user, create a .service file in /etc/systemd/user:

sudo nano /etc/systemd/user/my_service.service

Specify the service specifics:


ExecStop=/usr/bin/kill -HUP $MAINPID


It's important that WantedBy is set to

Save the unit file, and reload the systemd daemon using the systemctl --user daemon-reload command. Enable and start the service as the user:

systemctl --user enable my_service.service
systemctl --user start my_service.service

Finally, run the sudo loginctl enable-linger USER command (replace USER with the actual user).