Re: Preventing application termination if ttyPATH device is not found

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

 





On Thu, Feb 28, 2019 at 8:45 AM Dhananjay Patil <Dhananjay.Patil@xxxxxxxx> wrote:

Hi All,

 

I have following question:

  1. Is there any way to prevent application from termination  if  ttyPATH device not found
  2. How to set Standard output device as pseudo terminal device for service? So when user login using ssh/telnet standard output will be available on this device


You cannot assign the telnet pty device dynamically, if that's what you're trying to achieve.

Most of the time (probably all of the time), your service will start before any telnet connections or ptys exist yet. So a service has TTYPath=/dev/pts/0, systemd has only two choices: either fail the service entirely, or start it with another stdout (e.g. null or journal).

But once the service is already running, systemd *cannot* change the service's standard output – only the process itself can change its stdout. You cannot have a .service that starts without a tty but automagically "attaches" to /dev/pts/0 as soon as you telnet into the system.

You'll need additional software to really achieve this. For example, you could use StandardOutput=journal (the default) but add a custom syslogd daemon that reads journal messages containing your printfs and duplicates them across all existing ptys. (AFAIK, some existing syslog daemons can already do this.)

Or just manually run `journalctl --follow --unit=myapp.service` after telnetting in.

--
Mantas Mikulėnas
_______________________________________________
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