Score:0

Display service output on console using systemctl

in flag

I have following service file -

[Unit]
Description=Open VPN Agent
After=syslog.target
After=network.target

[Service]
Type=forking
TTYPath=/dev/pts/0
KillMode=process
PIDFile=/opt/openVPN/pids/openvpnAgent.pid
ExecStart=/opt/openVPN/openvpnAgent start
ExecStop=/opt/openVPN/openvpnAgent stop
SuccessExitStatus=143
StandardOutput=tty

[Install]
WantedBy=multi-user.target

When I connect to SSH and run tty command, if output is "/dev/pts/0", in that case only output is displayed on console. If "tty" command gets different value, then output is does not get displayed on console. And with every SSH session, "tty" command's value is different. How to set "TTYPath" generic so that output gets displayed for any "tty"?

Michael Hampton avatar
cz flag
Don't try to do this. It is not possible anyway. Let the system log normally and view the logs yourself when necessary.
user784524 avatar
in flag
But there is need to display output explicitly on console? What can be done for that? Any other options?
slightly_toasted avatar
bd flag
@user784524 `tail -f /path/to/log/file`
Michael Hampton avatar
cz flag
Use `journalctl` as normal.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.