[systemd-devel] soft-reboot and service templates
Lennart Poettering
lennart at poettering.net
Mon Jun 10 09:47:03 UTC 2024
On Mi, 05.06.24 14:58, Luca Boccassi (luca.boccassi at gmail.com) wrote:
> On Wed, 5 Jun 2024 at 14:45, Thorsten Kukuk <kukuk at suse.com> wrote:
> >
> > Hi,
> >
> > while playing with soft-reboot and services surviving this:
> > A standard service file works, but if I use a service template (e.g.
> > test at .service), the service get's stopped during soft-reboot.
> > Reasons is:
> > -Slice=system.slice
> > +Slice=system-test.slice
> >
> > Is it somehow possible, that also "test at .service" stays alive during a
> > soft-reboot?
> > Or is there another way to pass variables to a service file at
> > startup? I don't need to run the same service several times in
> > parallel.
> >
> > Thanks,
> > Thorsten
>
> Yeah we haven't tested this scenario at all - did you try adding a
> drop-in for system-test.slice.d that sets the parameters to avoid
> having it stopped on softreboot?
Instead of a drop-in I'd either:
1. just define the slice unit fully yourself and give it a nice
Description= and things, and set the settings different from the
defaults as you like. Or in other words, instead of adding
"system-test.slice.d/50-something.conf" just add
"system-test.slice" itself. (The fact you don't have to provide
.slice unit files at all is convenience, not more, it doesn't mean
you should not define unit files for slices, I'd encourage everyone
to do that, and at the very least define a nice Description=)
2. You can just set Slice=system.slice in your template unit file, to
override the default slice that groups template instances.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list