Hi,

On Thu, Jan 29, 2026 at 06:35:19PM +0000, Chris Green wrote:
> I am a bit confused by systemd user services.

Just FYI the "user" part here is a bit redundant as what you're asking
about is templated services, which is a general concept that also
applies to system services.

> I have two service files in ~/.config/systemd/user/ as follows:-
> 
>     -rw-rw-r-- 1 chris chris 184 Jan 29 18:14 [email protected]
>     -rw-rw-r-- 1 chris chris 178 Jan 27 21:32 helmlcd.service

The first is a templated service while the second isn't. Templated
services allow the same service unit to be used multiple times as
different "instances" of the same service. In your case you have an
instance named "chris".

> The differences in [email protected] are just the description and
> the executable file:-
> 
>     [Unit]
>     Description=Run the Flying Bridge display
> 
>     [Service]
>     Type=simple
>     StandardOutput=journal
>     ExecStart=/home/chris/bin/fblcd.py
>     Restart=on-failure
> 
>     [Install]
>     WantedBy=default.target

Normally a templated service makes use of the instance by the specifier
"%i" somewhere in the unit file, often the ExecStart like, e.g. to set a
command-line option or load a specific config. Yours doesn't, so it may
be just an arbitrary string to allow multiple of these to be run at
once. Or maybe systemd also sets something in the environment and
/home/chris/bin/fblcd.py is reading that. I am not familiar with that
script.

> Both are installed and run (using systemctl) in the same way, so
> what's the difference between them?  What does the @chris do, if
> anything?

It's an identifier that allows multiple instances of the "fblcd" service
to run at the same time.

If you only use one instance and never make use of the string expansion
then it has no effect.

> These are both written by me so they may very likely be misconfigured
> in some way. :-)  They are running on a headless system and I want
> them to run when the system is [re]booted.  They run continuously
> displaying electrical values on two LCD displays.

Is there a reason you chose to use '@chris' in the service file name
without knowing what it does?

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting

Reply via email to