Can I attach an orphan to a tty?
09/01/2018 9:30
Hi Group, One of my processes ( a newsgroup binary assembler to be specific ) was running in the background when I logged out from the controlling tty. The process is still running and has been 'adopted' by init and is running with no controlling tty. Is there a way I can attach it to one now ? Usually I use screen to run it inside a virtual session that I share between work and home, but this time I wasn't using one.

OS: RH 8.0 based, running vanilla 2.4.20Platform: Intel P4 thanks!Nair

Source is Usenet: comp.os.linux.development.system
Sign in to add a comment

Answer score: 5
09/01/2018 9:30 - strace is the way to go then. And I won't forget to run it in a screen the next time.

Thanks for the splendid reply, Kasper.

Nandu.


Source is Usenet: comp.os.linux.development.system
Sign in to add a comment

Answer score: 5
09/01/2018 9:30 - Not really. It is theoretically possible to do by messing around withptrace, but it takes a lot of work to get that right. I don't thinkthat is worth the effort.

What is important about the controlling tty is that it can send somesignals to the process. But those signals you can send as well byusing the kill command.

If your process has open file descriptors open for the tty, you willsee those to start behaving similar to /dev/null as the tty is hungup. That is not directly related to the controlling tty, you can haveaccess to a tty though it is not your controlling tty.

There is no way you can get those hung up file descriptors behavelike a normal tty again. But it is of course possible to open a newtty, but again doing this on a running process is a horrible messwith ptrace.

If you just want to get an idea about what output the process istrying to write to a tty, it is simpler to just use the stracecommand.

And next time remember to use screen, it really is a great tool.


Source is Usenet: comp.os.linux.development.system
Sign in to add a comment

eDiscover
Helpforce eDiscover provides technical articles updated each dayHelpforce eDiscover RSS feed contains the latest technical articles in RSS
Click the logo to go back to the main page
Search eDiscover
  
Categories

Click an icon to go to that category

Helpforce eDiscover contains articles about Microsoft Windows Helpforce eDiscover contains articles about Apple products and MacOS Helpforce eDiscover contains articles about Linux and POSIX operating systems Helpforce eDiscover contains articles about Helpforce Helpforce has a large variety of technical information and articles for you to read Helpforce eDiscover contains articles about databases, MYSQL, SQL Server Oracle Helpforce eDiscover contains articles about Java, JVM and the JRE Helpforce eDiscover contains articles about the QNX operating system Helpforce eDiscover contains articles about Oracle Solaris and Open Solaris Helpforce eDiscover contains articles about RISC OS, Acorn and the BBC Micro Helpforce eDiscover contains articles about Amiga and AmigaOS

Type your comment into the box below