Score:0

Is it possible to connect to a user session and see its output in Linux?

cn flag

I am replacing a windows app with linux command line app. It is supposed to output simple statistics so user can check if the app is alive.

In windows it is run 24/7 and you can connect to a desktop via RDP and see whats going on in the console window.

How can I achieve the same on linux (CentOS)?

The app must never be interrupted - it has to stay up as long as possible

Score:1
cn flag
Bob

Applications that run 24/7 are generally considered services in my opinion.

Usually services on Linux get started by a process supervisor, typically at boot time, such as by the common default systemd or one of the alternatives listed here: https://en.wikipedia.org/wiki/Process_supervision

That supervisor can can then perform service/application restarts when needed and capture and log standard/error output so it won't be lost.

As a sysadmin you can then interact with either the logs or the process supervisor to check the status of your service.

Personally I prefer that services don't rely on the supervisor for all their logging, in other words that they do not only log to stdout and stderr. Services should only generate (copious amounts of) standard output (write to the console) when started with a (debug) switch and/or when throwing critical errors and dying. During normal operations services should have the option to maintain their own log file(s) to record requests, statistics, errors, statistics and other relevant events.
But that may be overkill for your application.

Boppity Bop avatar
cn flag
yes that what it does - it logs a lot of data received from a remote server to files. the stdout is just for an admin to control that everything is running ok - sometime subscriptions to remote server expire (logic controlled by the remote server - there are no notifications they expired). So admin should be able to easily spot which subscriptions are out and change the local logging app in question with correct config. in Windows the stats for admin printed every 2 sec. I would not want this to be in system logs as it will clog it. this normally happen once a month at diff dates for diff subs
Score:0
cn flag

Although I agree with idea to make it a service but some unconventional limitations beyond my control dictate it has to be an interactive session.

I resolved it by using screen

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.