LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] [OT] Reconnecting to standard output - Solaris

[ILUG] [OT] Reconnecting to standard output - Solaris

Ciaran Johnston cj at nologic.org
Fri Jan 9 16:16:20 GMT 2004


> Ciaran Johnston wrote:
>> Hi folks, and a happy new year to you all.
>>
>> Here's a tricky one, and apologies for the off-topic nature of the
>> post: If I start a process from a shell which runs in the background,
>> the standard output of that shell is tied to that terminal. In
>> solaris, if I exit the shell, the background process keeps running,
>> but loses it's tty
>
> Are you sure it keeps running?

Positive. It even happens with emacs.
> Where does the output go to?

This is the big question. /dev/null?

> The behaviour under linux for background processes is to
> be suspended if they output.

What happens under solaris is a *lot* different. Starting a process with &
puts it in the background, with the terminal set to the current terminal
and the PPID set to the current terminal's PID. When you exit the
terminal, the terminal becomes "?" and the PPID becomes 1. Otherwise the
process keeps running.

This even happens with GUI apps on remote servers. From client1 I can log
into server1, from that I can log into server2, I can export my display to
client1:0.0 and run emacs& (the GUI version), then exit all the shells and
still use emacs. Is this correct behaviour (apart from the fact I'm not
using vi)?

>
>> (ps just shows a ? where once there was "pts/13" or whatever). Is
>> there any way to reconnect a new terminal to this process, or
>> otherwise get hold of the standard output?
>
> Not on linux anyway.

No. Not on Solaris, either, it appears.

>
>> The linux approach appears to be that if the terminal dies so do the
>> children, which is a good bit cleaner IMO.
>
> Depends on the shell. You can control it explicitly with the nohup
> command which makes the background process ignore the terminal HUP
> signal, and also store the output to file. I prefer screen for
> all this sort of messing though. Much more powerful:
> http://www.pixelbeat.org/lkdb/screen.html

This behaviour (explicit control required) seems a lot cleaner than the
Solaris approach, and you'll never lose the output.

We have a customer with a 3PP app running on a live system. The 3PP is
started from the command line. Certain informational and debugging output
goes to the standard output. They restarted the whole app recently and
lost a whole load of live data, so they don't want to restart it again.
However, the shell it was originally started from is since gone, and we
need to see that standard output. Gah. I guess I'll just have to tell them
to restart and pipe the output to a file.

Thanks,
Ciaran.





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell