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

Re: SystemD problem with launching a server

On 08/09/2018 08:02 AM, Bill wrote:
> So I've written a service file for systemd,
> /etc/systemd/system/rinetd.service and enabled it with systemctl enable
> /etc/systemd/system/rinetd.service. At boot time the file gets run but
> nothing shows up with ps aux, although sshd is running correctly. I
> think the problem is with the systemd file. Here's the rinetd.service file:
> # /etc/systemd/system/rinetd.service
> # A systemd.service file to start
> # /usr/sbin/rinetd at boot time.
> [Unit]
> Description=Start rinetd server
> After=multi-user.target network.target sshd.service
> [Service]
> Type=oneshot
> ExecStart=/usr/sbin/rinetd
> Restart=no
> [Install]
> WantedBy=multi-user.target

I suspect this is because rinetd is forking and not a oneshot script.
You have two choices here: you may use Tye=simple and pass -f to rinetd
(probably recommended, more straightforward to stop the process) or use
Type=forking and leave the rest as-is.

Type=oneshot is used for exactly that, one-shot scripts that are run
once and do not persist. Since rinetd does persist (forks by default),
oneshot is not a good choice here. It wouldn't let you stop the service
through systemd, for instance, even if it worked, without adding
ExecStop manually.

When writing service unit files, I especially find systemd.service(5)
and systemd.exec(5) helpful. Also see systemd.unit(5) for more generic
information on unit files as a whole.

Good luck!

Reply to: