Discussion:
require=? to prevent premature session termination
(too old to reply)
Ralf Sieger
2018-10-05 12:52:55 UTC
Permalink
_______________________________________________
systemd-devel mailing list
systemd-***@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Reindl Harald
2018-10-05 13:03:01 UTC
Permalink
my service needs to delay the stop of ssh during shutdown.
New ssh connections while my service is still runnign must be accpted, too.
 
[Unit]
BindsTo=ssh.service getty.target
After=ssh.service getty.target
 
[Service]
Type=simple
TimeoutStopSec=600
ExecStart=/usr/local/bin/rbs
 
[Install]
WantedBy=multi-user.target
 
The remaining problem is that upon shutdown/restart existing ssh users
still get disconnected.
How can I that postpone, too? or, better: what is the missing depdency?
well, when you say "After=ssh.service" you get started after ssh at boot
and since shutdown is the reverse order ssh is terminated before your
service

so i would just say "Before=ssh.service" instead "After=ssh.service" ,
in that case ssh connections are only accepted after your service is
started and ssh is not killed as long your service is running

you can have only one of both

it's impossible to decalre a different order at boot and at shutdown
becaus eit makes no sense - you express ordering meaning "x makes only
sense after y is started" and the logical consequence is that the
sutdown acts in reverse order

when you say "After=myqld" you wan't to get started after mysqld because
your service can't live wothout, so it amkes zero sense at shutdown kill
mysqld first and then your service, given it's a webserver depending on
a working database otherwise it would accept new client connections it
can't handle
Ralf Sieger
2018-10-05 16:07:52 UTC
Permalink
_______________________________________________
systemd-devel mailing list
systemd-***@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Reindl Harald
2018-10-06 17:40:10 UTC
Permalink
"if a unit is configured with |After=| on another unit, the former is
stopped before the latter if both are shut down "
a has After=b
1. start b
2. start a
and thus the reverse on shutdown should be
1. stop a
2. stop b
Which is what I want. I wannt to be stopped first.
obviously no
I have only the problem that existing ssh sessions get terminated before
the stop reaches my service.
SSH itself keeps runnign and I can login
when you start "After=ssh.service" it implies that "ssh.service" is
terminated before your service at shutdown - it's really that simple
Andrei Borzenkov
2018-10-06 18:58:51 UTC
Permalink
Post by Reindl Harald
when you start "After=ssh.service" it implies that "ssh.service" is
terminated before your service at shutdown - it's really that simple
Wrong.
Andrei Borzenkov
2018-10-06 03:46:08 UTC
Permalink
Hi,
my service needs to delay the stop of ssh during shutdown.
New ssh connections while my service is still runnign must be accpted, too.
[Unit]
BindsTo=ssh.service getty.target
After=ssh.service getty.target
[Service]
Type=simple
TimeoutStopSec=600
ExecStart=/usr/local/bin/rbs
[Install]
WantedBy=multi-user.target
The remaining problem is that upon shutdown/restart existing ssh users still get
disconnected.
Shutdown/restart of what? The whole system?
How can I that postpone, too? or, better: what is the missing depdency?
Any ideas?
Regards,
Ralf
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Ralf Sieger
2018-10-06 13:42:10 UTC
Permalink
_______________________________________________
systemd-devel mailing list
systemd-***@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Andrei Borzenkov
2018-10-06 18:59:29 UTC
Permalink
Yes, restart of the whole system.
User sessions are run outside of ssh service in own scope and belong to
user slice which is terminated separately during shutdown. Since v239 it
is possible to add drop-ins to user slices and scopes which allows you
to order some barrier service after them.
Regards,
Ralf
*Gesendet:* Samstag, 06. Oktober 2018 um 05:46 Uhr
*Betreff:* Re: [systemd-devel] require=? to prevent premature session termination
Hi,
my service needs to delay the stop of ssh during shutdown.
New ssh connections while my service is still runnign must be accpted, too.
[Unit]
BindsTo=ssh.service getty.target
After=ssh.service getty.target
[Service]
Type=simple
TimeoutStopSec=600
ExecStart=/usr/local/bin/rbs
[Install]
WantedBy=multi-user.target
The remaining problem is that upon shutdown/restart existing ssh users still get
disconnected.
Shutdown/restart of what? The whole system?
How can I that postpone, too? or, better: what is the missing depdency?
Any ideas?
Regards,
Ralf
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Continue reading on narkive:
Loading...