Setup systemd service for a user



systemd service

systemd is a Linux initialization system and service manager that is responsible for starting all the process on the system.

Services like Network interfaces, bluetooth daemon, mounting file systems, cron jobs, system updates, upgrades, everything gets started from sytemd. All these tasks are called systemd units. You can see all running services on your linux system:

$ systemctl list-unit-files | grep enabled
mnt-data.mount                             generated       enabled
apt-daily-upgrade.service                  static          enabled
apt-daily.service                          static          enabled
autovt@.service                            enabled         enabled
avahi-daemon.service                       enabled         enabled
bluetooth.service                          enabled         enabled
wpa_supplicant-nl80211@.service            disabled        enabled
wpa_supplicant-wired@.service              disabled        enabled
wpa_supplicant.service                     enabled         enabled
wpa_supplicant@.service                    disabled        enabled

All these units/services have a configuration file that contains details around when to start the service, what command to execute to start the service, dependency on other services and order in which they need to start.

These services can be for whole system or for specific user. We will see how to setup such a service for specific user.

Setting up systemd service as user

Such services can also be for a specific user. For example we can run a script or command to fetch emails automatically only for certain user.

Keep the service running