[systemd-devel] Multiple services using the same core service?

林自均 johnlinp at gmail.com
Sat Jan 27 15:47:56 UTC 2018


Hi Lennart,

Thank you, I will reconsider this design.

John Lin

Lennart Poettering <lennart at poettering.net> 於 2018年1月24日 週三 19:41 寫道:

> On Di, 26.12.17 01:39, 林自均 (johnlinp at gmail.com) wrote:
>
> > Hi folks,
> >
> > I am trying to achieve:
> >
> >     # systemctl start sshd-shell.service (1)
> >     # systemctl start sshd-sftp.service (2)
> >     # systemctl stop sshd-shell.service (3)
> >     # systemctl stop sshd-sftp.service (4)
> >
> > Before the command (1), sshd is not running. By typing (1),
> > /etc/sshd_config is configured to accept ssh shell connections but no
> sftp
> > connections, and then start sshd. By typing (2), /etc/sshd_config is
> > configured to accept sftp connections too, and sshd is reloaded. By
> typing
> > (3), /etc/sshd_config is configured to refuse ssh shell connection, and
> > sshd is reloaded again. By typing (4), sshd will be stopped.
>
> Quite frankly, this is not really in line with how systemd services
> are supposed to be used. They are supposed to wrap running processes,
> but not wrap configuration applied to others really.
>
> But anyway, of course, it's up to you how to make use of this stuff...
>
> > The current problem is that I don't know if there is a better way to
> > achieve this. For example, I have to sleep 1 second before reloading
> > sshd-core.service in sshd-shell.service because otherwise sshd didn't
> setup
> > the signal handler for SIGHUP and will terminate itself. Or systemd
> doesn't
> > suggest such use case?
>
> Yes, it's not really in-line with how this stuff was designed...
>
> That said, I am pretty sure there's something wrong with your
> sshd-core.service: the unit should not be considered up before the
> daemon process is fully running, and that includes having set up
> SIGHUP handlers properly.
>
> Most likely the Type= stuff is not set up correctly in that unit (or
> sshd is broken and doesn't set things up fully before reporting its
> startup being complete).
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180127/547d7066/attachment.html>


More information about the systemd-devel mailing list