LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Open new shell terminal to allow command entry without crashing main app (https://www.linuxquestions.org/questions/linux-newbie-8/open-new-shell-terminal-to-allow-command-entry-without-crashing-main-app-777247/)

skipunda 12-21-2009 10:45 AM

Open new shell terminal to allow command entry without crashing main app
 
Hi All,

I am relatively new to linux (know enough to be dangerous!) and new to this forum.

What I am trying to do is open an interactive shell terminal so that process information can be obtained.

Currently, the software we are running contains debug/monitoring software. What I would like to do is exit out of the debug into a new shell terminal and enter commands such as cat/proc/meminfo without interrupting the main app that is running. I then would exit the shell with exit or control-d.

I have tried 'system("/bin/sh -i");' in the appropriate software file to get an interactive terminal. This opens up a new terminal, but unfortunately as soon as I press any key, the main app crashes and the following is received: [1]+ Stopped (SIGVTALRM) run.

I'm not sure what else I need to do to get this to work.

I hope this makes some sort of sense.

Any help and advice would be greatly appreciated.

Many thanks in advance.

David1357 12-21-2009 11:46 AM

Quote:

Originally Posted by skipunda (Post 3800068)
Currently, the software we are running contains debug/monitoring software. What I would like to do is exit out of the debug into a new shell terminal and enter commands such as cat/proc/meminfo without interrupting the main app that is running. I then would exit the shell with exit or control-d.

Why don't you just have the program itself execute the "cat /proc/meminfo"?

WARNING: Speculation follows:
It sounds like you are calling "system" in the same thread context as the "debug/monitoring" software, which may cause a timeout to expire and issue the SIGVTALARM. You might have better success making your call to "system" from another thread.

However, without a better understanding of how "the software we are running" and the "debug/monitoring software" interact, I am not sure I can help you. Do the two parts of the software run in the same execution thread? Maybe you could provide a little diagram or verbal description of the overall software architecture.

dickgregory 12-22-2009 08:40 AM

Can you just log on to a virtual terminal and issue whatever commands you need? To get a VT login, just hit Shift-Alt-F1 and log in. To get back to your main app, assuming it is running in a GUI, hit Alt-F7.

Most distros have 6 VT's, accessed by Shift-Alt-F(n) where n = the VT # (1-6). VT 7 is usually your GUI session, but you can also bring up VT 8, VT 9, etc. with the switch user feature, usually accessed via the logout menu.

skipunda 12-22-2009 08:55 AM

Turns out the problem was thread related.

Thanks to all who replied because it was these replies that enabled me to solve the problem.


All times are GMT -5. The time now is 03:09 AM.