Okay, so I have a program (which I did not write and cannot modify) which I am running as a service using systemd on my Ubuntu 16.04 cloud server. It's working great, except that I need to be able to interact with the running program, and the only way the program supports interacting with it is via stdin/stdout. I realize it's pretty unconventional for a service to use only command-line input, but I don't see what other choice I have.
From what I've read here, it's possible to tell a service to use TTY for stdin and stdout, and so I think I've setup my service to do just that:
[Unit]
Description=My Service
After=getty@tty2.service
[Service]
Type=simple
ExecStart=/path/to/my/service
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty2
TTYReset=yes
TTYVHangup=yes
Restart=always
RestartSec=5
User=username
[Install]
WantedBy=multi-user.target
Once my service is running (and yes, it's definitely running), I try using the screen command in PuTTY to view /dev/tty2 as described in this answer:
sudo screen /dev/tty2
However, when I do that all I see in PuTTY is a blank screen with no output that I cannot interact with. (And yes, the program generates plenty of output while running.)
So I'm not sure where I've gone wrong, whether it's in the configuration of the service, my usage of the screen command, or with PuTTY itself. I'm not a super experienced user of Linux in general and this is my first time doing anything with TTY, so my understanding is pretty thin.