Results 1 to 6 of 6
Hi all, I'm new to solaris and i have some problem.. hope you guys can help me out.
Currently i'm doing a script for my project and I want to ...
- 11-12-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 3
[SOLVED] Need help here! prevent terminal from closing!
Hi all, I'm new to solaris and i have some problem.. hope you guys can help me out.
Currently i'm doing a script for my project and I want to prevent people from exiting the terminal by clicking the "X" at the top right.
so in short:
when I run the script,
user cannot exit out of the terminal
unless the scipt finish running.
Thanks alot !
- 11-13-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
As far as I know, you can't - it would depend upon the terminal window program that is running your shell. I know that the KDE kconsole program doesn't allow disabling the "close window" button under any circumstances. That said, you can do this in an X11 program by intercepting the close-window event. So, it comes down to whether or not you want to write your own X-term program that will handle this scenario. I think that is likely what you would have to do.
Anyway, maybe some other lurker here knows how to do what you want without a lot of custom C or C++ coding...
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 11-14-2010 #3Just Joined!
- Join Date
- Nov 2010
- Posts
- 3
Thanks for the reply,
but just to add on,
I'm using bash for for this project and i heard from someone form other forum saying that trap SIGHUPs works... but i not sure how he did it.
- 11-17-2010 #4
There is definitely no way to do this. Even if it was possible for a particular terminal (that was, for some reason using something SIGHUP to kill processes), there is no guarantee that it would work for others.
I suspect that every terminal uses SIGKILL or SIGSTOP to kill its child processes, and these cannot be ignored by a process.
You can always disassociate your process from the terminal by making it a daemon, and that way it could run until it finishes, no matter what the user does.DISTRO=Arch
Registered Linux User #388732
- 11-17-2010 #5
What is it exactly that you are trying to do? Because the way I see it, you start with asking how to develop a certain solution that is going to be, if not difficult then very difficult. Perhaps there is another solution that is much easier to achieve...
Let's look at the problem first
because in most instances the running of a script should not depend on the openness of a terminal window or users repressing the urge to click an X
Can't tell an OS by it's GUI
- 11-17-2010 #6Just Joined!
- Join Date
- Nov 2010
- Posts
- 3
Thanks for replying ppl!
I have found the solution to the problem already!
Again... Thanks!


