Re: require=? to prevent premature session termination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hm, according to the docs this is not the case:
"if a unit is configured with After= on another unit, the former is stopped before the latter if both are shut down "
I read this as:
a has After=b
then the start ording should be:
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.
 
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.
 
Regards,

Ralf
 
 
Gesendet: Freitag, 05. Oktober 2018 um 15:03 Uhr
Von: "Reindl Harald" <h.reindl@xxxxxxxxxxxxx>
An: systemd-devel@xxxxxxxxxxxxxxxxxxxxx
Betreff: Re: require=? to prevent premature session termination


Am 05.10.18 um 14:52 schrieb Ralf Sieger:
> my service needs to delay the stop of ssh during shutdown.
> New ssh connections while my service is still runnign must be accpted, too.
>  
> So far I was able to postpone the stop of ssh and allow new connections:
> [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
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux