How do I use systemd services in /usr/lib/systemd/?

Oin

How are services installed by the package manager (in /usr/lib/systemd/) supposed to be used in Debian (9.5)?

I can see loads of services installed in /usr/lib/systemd/user, but these are not available via the normal systemctl status my-service command. Am I supposed to manually copy the services I want to use into /etc/systemd/user/?

Wieland

Systemd allows you to have a user-specific services for each user in addition to the system-wide services. Those can be managed by regular systemctl command (stop, start, status, edit, enable, ...) if you add the --user flag. If you have for example /usr/lib/systemd/user/syncthing.service, the system-wide service manager doesn't know about it, but the one for users does:

↪ ls /usr/lib/systemd/user/syncthing.service 
Permissions Size User Date Modified Name
.rw-r--r--   285 root 13 Jun 20:40  /usr/lib/systemd/user/syncthing.service
↪ systemctl status syncthing                                                                                     
Unit syncthing.service could not be found.
↪ systemctl --user status syncthing               
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
   Loaded: loaded (/usr/lib/systemd/user/syncthing.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-07-24 17:10:22 CEST; 2 weeks 3 days ago
     Docs: man:syncthing(1)
 Main PID: 815 (syncthing)
   CGroup: /user.slice/user-1000.slice/[email protected]/syncthing.service
           └─815 /usr/bin/syncthing -no-browser -no-restart -logflags=0

systemctl status --user can be used to list all currently active units for the current user.

It's also possible for users to define their own units if they are unable to write to /usr/lib/systemd/user or for the administrator to define user units local to the system, by adding them to one of the directories listed for this purpose in systemd.unit(5):

  • ~/.config/systemd/user/
  • /etc/systemd/user/
  • $XDG_RUNTIME_DIR/systemd/user/
  • ~/.local/share/systemd/user/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I reload a group of systemd services?

How do I override or configure systemd services?

How do I run multiple carbon services in one systemd file?

How do I change the order in which systemd services are started up

How can I disable Pulseaudio system mode and use the normal systemd per user services on a headless server?

How do I setup user autostart and properly configure systemd user services?

How do I use Declarative Services to ensure that EventAdmin is not null?

How do I use docker services within a android emulator

How to remove systemd services

How do systemd and chkconfig interact with respect to services and runlevels?

How do you keep systemd user services alive over mosh?

Use Systemd user services with ecryptfs

How do I change the runlevel on systemd?

How do I see the iptables logs in systemd

How do I get Debian to use systemd-logind for user session control?

On chef, using poise-service and poise-monit, how do I use systemd as the underlying

How do I use systemd to replace cron jobs meant to run every five minutes?

How do I use cgroups in fstab instead of default /sys/fs/cgroup from systemd?

How do I use base classes across my view models and services in MVC?

how do I use AZ CLI to configure Azure MariaDB to enable 'allow access to Azure services'?

How do I configure two instance of Azure Mobile Services to use the same application key?

How do I use a multi-value parameter in an iif expression in SSRS (SQL Server Reporting Services)?

How do I use Blue-Green Deployment in Pivotal Web Services?

Asp.net core - How do I use a service that is setup in configure services in the configure method?

c# .NET MVC 4 - How do I create Quartz jobs that use Ninject services?

My rest services relies on an external service. How do I mock it to use on my cucumber tests?

Do I need set ulimit for system services, such as nginx.service(systemd)/nginx(sysv)?

How do I export services in a module?

How do I test services in polymer?