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!

My first thought was to remove the frame with the "X" button, but its is added by the window manager; metacity, so it turned out to be a rather bad idea.
However, when you click 'X' in a terminal window it will send a SIGHUP to the window in question, so all you have to do is to catch SIGHUP signals before you run your script, i.e, to run "/bin/true" when you get a SIGHUP:
# trap /bin/true HUP
# ./path/to/some/script
A third method would be to determine the parent shell process from the script itself, and then use the 'nohup' command to force the parent process to ignore SIGHUPs, for example:
mybox(~):$ cat dont_kill_me.sh
#!/bin/sh
shell=`ptree $$ |grep sh |head -1 |awk '{print $1}'`
nohup -pa ${shell}
while :; do
/bin/echo "enter something: \c"
read something
echo "got: $something"
if [ "${something}" = "quit" ]; then
exit 0
fi
done
mybox(~):$
If you run this script, it will not directly be affected by clicking the 'X'.
However, the nohup will only be effective during the lifetime of the script. So if you start the script and click "X", your script will finish, but once the script is finished the SIGHUP will be sent to the shell..
.7/M.

Similar Messages

  • Problem in preventing Joptionpane from closing??

    Hi all,
    I am using Joptionpane in which i am having 3 optional buttons
    clicking on one of these buttons, i should pop up another dialog with optionpane being alive(i.e. not closed). Here the problem is that as soon as i click on one of the buttons in the option pane, it is automatically gets closed.How can i prevent it from closing.It should be closed only after the popped up Dialog is closed..(like modal property)
    How can i do this..
    help me pls..

    Im not exactly a swing expert, and i dont know if thers a way to prevent a JOptionPane from closing, but you could just use a JFrame to display your dialogue.

  • Prevent Someone from closing window

    I am currently filling out a form on safari and there is no option to save my work so I will have to leave it up on the screen all day. My younger sibling use the computer too and have already accidentally closed it and have started over 2 times. Is there a way I can prevent someone from closing the window or lock it in any way????

    Hi
    Welcome to Apple Discussions
    No way to lock-in a window, however, if you have administrative control of the system, you can set up a separate user account for others (System Preferences>Accounts). This way, only you have access to your files etc. in your User Account, while affording others the same in their user account.

  • Prevent user from closing the applications

    Hello,
    we would like to deploy to our users web application using Internet Explorer which is published over RemoteApps. Because this application takes long time to load we would like to prevent user from closing application. So we would like that session and application
    stays opened when the user clicks on close button on Internet Explorer that is published over RemoteApps.
    In other words, we would like to disconnect client from RemoteApp session, but stay logged in and keep the application running in the background.
    Is this possible to do?
    Thank you!
    Best wishes,
    Marko

    Hello,
    thank you all for your answer. I guess this is not a good news. Any other idea how to solve this problem - to start Internet Explorer web application as soon as possible.
    Last week I have found a VB script on one forum that would close the RemoteApp Windows without closing the appliaction on server but I can't find it today. Does anybody know something about this script?
    Thank you!
    Best wishes,
    Marko

  • Mx.core.Window - prevent user from closing the window?

    Hi,
    mx.core.Window has properties 'maximizable' &
    'minimizable', but there doesn't seem to be any 'closable'
    property. In my application I'm creating another window (apart from
    the main application window) that needs to be open the whole time
    the application is running. If I can't prevent the user from
    closing the window, then I'll have to rig up some code to
    automatically re-open it if the user closes it. I'm hoping there's
    a way to prevent the user from closing the window in the first
    place though.
    I'll much appreciate any ideas - thanks :)

    Listen for the window's closing event and call
    preventDefault().

  • Prevent customer from closing from

    Hi all,
    I have to prevent the customer from closing a form depending on a value i want to check.
    It is not only closing the distinct form but also he may not be allowed to close forms runtime.
    How can I do this?
    Forms 6i, Oracle 9i
    Thanks,
    Silke

    Silke,
    try a key-exit trigger on the Forms level. Use exit_form in this trigger to leave a form, don't do antyhing - or raise an alert - if the user shouldn't leave the form.
    However, once this application should be moved to the Web there will be an issue that you cannot handle gracefully.
    It's when the user closes the Browser Window to close Forms (this is similar to killing the runtime engine process in client/server). In this case all uncommited changes get lost.
    Frank

  • How can I prevent Firefox from closing when it crashes?

    So, I'm using a Windows 8 computer, & when it crashes, it closes altogether & it's really annoying having to reload my session, but when I was using a Windows 7 computer, Firefox hardly ever closed altogether when it crashed- all it did was freeze. Is there some way to only have it freeze instead of closing altogether? I hope you understand what I'm saying. Thanks.

    If only, if only! :)
    No, there isn't a way you can choose what Firefox does when it crashes. It crashes for a reason. But we can see what's causing those crashes.
    Can you give me your crash reports?
    #Enter ''about:crashes'' in the Firefox address bar and press Enter. A Submitted Crash Reports list will appear, similar to the one shown below.
    #Copy the '''5''' most recent Report IDs that start with '''bp-''' and paste them into your response here.
    Your System Details looks very light/empty. Can you start by giving us the troubleshooting information from the Firefox installation that's having problems. This is an essential step in troubleshooting.<br>
    *Click the Firefox button at the top left, then click the ''Help'' menu and select ''Troubleshooting Information'' from the sub-menu. If you don't have a Firefox button, click the Help menu at the top and select ''Troubleshooting Information'' from the menu.
    Now, a new tab containing your troubleshooting information should open.
    *At the top of the page, you should see a button that says "Copy text to clipboard". Click it.
    *Now, go back to your forum post and click inside the reply box. Press Ctrl+V to paste all the information you copied into the forum post.

  • Prevent Browser From Closing

    I've written an applet that our customers use to upload large files to our FTP server. The applet sometimes needs to run for hours, but some of our less tech-savvy customers will forget and close the browser before it's done.
    The applet is signed (i.e. it's out of the sandbox) -- is there any way it can catch the browser closing and prevent it, so we can put up the obligatory "Are you sure you wanna do that?!" message box?

    Perfect, Geoff, that's exactly what I was after. I should award you points for this thread, too (http://forum.java.sun.com/thread.jspa?threadID=5272299), because now I don't need the stupid blinking text. :)
    I wish the replies I was getting to my other questions were even half as good. Look at this one (http://forum.java.sun.com/thread.jspa?threadID=5272305); the first guy tells me how to use Google, as if anyone using a computer in 2008 doesn't know how to do this (especially a developer), and the second guy actually Googles it then copies and pastes code form the first hit: the exact same code I'm already using. **sigh** Must have something to do with this whole 'duke star' business.

  • Prevent Terminal from ALWAYS launching X11

    Hi.
    I've installed Leopard as an upgrade from Tiger and I have a MacBook 2Ghz - 2GB RAM
    I know that Leopard launches X11 when I type xterm or something that needs xwindow.
    The problem is that in my machine (unlike my colleague's who installed from scratch) as soon as I click on the terminal icon I get the X11 starting as well.
    Moreover, as soon as quit Terminal (completely), X11 stays running. Then if I quit it, besides asking me for confirmation saying there are applications using it, it starts again. Sometimes I need to quit x11 2 times, other times even 4.
    What's this? Is there something weird going on?
    Why in my colleague's machine it only starts when necessary?
    I also noticed that when x11 is running the fan of my macbook starts...and it gets hot...
    Thanks a lot for your help.
    Marco

    Dear Bill,
    thank you very much for your help. I think I kind of solved the problem.
    The issue is about what bash was importing, I guess.
    I'm not sure why I didn't find it out before, but I finally managed to make it work.
    Basically, the alias with ssh -X was causing the launch of x11 at terminal startup (same with iTerminal).
    Moreover, running fink init.sh was causing the same thing. I don't why that but, as fink does not support Leopard yet, I decided to remove it. I mainly used it for Latex, but I can always download it separately. It's handy sometimes to use Linux stuff like xfig, gimp, etc. but I can definitely wait until they release the version supporting Leopard.
    I would also like to say thank you for solving the alias problem. Now, in .bash_profile I run source .bashrc so they are always loaded. Moreover, ssh -Y doesn't run x11 and that's good. It only does it when remotely I decide to run an app that needs x11. Which is very good (anyway, I usually do not use X remotely, unless I need to access webpages accessible only from university).
    So thanks a lot again and have a Merry Christmas
    Marco

  • Open interface error ...Preventing us from closing May-11

    Hi All
    we are running ERP 12.0.6 on solaris machines. IT was not allowing us to close MAY-11. Reason was there were some 22 error records in TRANSACTION OPEN INTERFACE.
    I cloned the PRODUCTION INSTANCE to TES to reproduce the problem and deleted all records from backend table (mtl_transactions_interface ) in test. Now its all fine in TEST and we can successfully close the month.
    1) Is it the right way of doing it.
    2) If not please suggest how wud i do the same in proper way.
    Regards
    Musaddaq

    Can you get the following for the errored transaction?
    SELECT   transaction_id txnid, transfer_transaction_id txfrtxnid
           , organization_id orgid, transfer_organization_id txfrorgid, subinventory_code subinv
           , transfer_subinventory txfrsubinv, cost_group_id cgid
           , transfer_cost_group_id txfrcgid       , prior_costed_quantity
           , transfer_prior_costed_quantity       , rcv_transaction_id rcvtxnid
           , transaction_action_id txnactid       , transaction_source_type_id txnsrctypid
           , transaction_type_id txntypid       , costed_flag cstdflg
           , transaction_group_id       , inventory_item_id invitmid
           , transaction_source_id wip_entity_id       , transaction_cost txncst
           , shipment_number shipnum       , new_cost       , prior_cost
           , actual_cost       , project_id       , transaction_uom txnuom
           , transaction_quantity txnqty       , primary_quantity priqty       , prior_costed_quantity priorqty
           , currency_code altcurr       , currency_conversion_rate currconvrt       , currency_conversion_date currconvdt
           , TO_CHAR (mmt.creation_date, 'dd-mm-yyyy hh24:mi:ss') creation_date
           , TO_CHAR (mmt.last_update_date, 'dd-mm-yyyy hh24:mi:ss')last_upd_date
           , ERROR_CODE errcode
           , error_explanation errexpl
        FROM mtl_material_transactions mmt
       WHERE transaction_id IN (&Trx_Id)   -- Error transaction_id
    ORDER BY transaction_id DESC

  • I have a 1/8 inch space at the bottom read messages display which prevents me from closing the email without closing this space which comes back when reopening

    The tab for closing the message is hidden at the top. When I close the gap, I can close the message. How do I permanently fix this problem so the tab will always be present?

    I'm having trouble visualizing the problem. Could you possibly post a screen shot or two showing what you mean? This article has tips on that, but please blur out or box out anything confidential/personal: [[How do I create a screenshot of my problem?]]

  • After Firefox opens my AOL home page a blank popup appears and prevents me from closing Firefox or opening the options button . How do I fix this?

    I can get to my home page with the Explorer browser. The problem is only on Firefox. I've run Spybot, Malwarebytes, and scanned with Microsoft Security Essentials, but the problem persists. I recently updated Firefox for AOL. And last night I installed updates for my Windows 7 operating system.
    I just tried to automatically add troubleshooting information, but I'm using Explorer right now since I can't use Firefox, so the I can't download the file. Since I can't use Firefox I can't use the manual steps either.

    Go to Tools --> Options.
    In the Advanced tab go to "General". Uncheck the check box "Warn me when websites try to redirect or reload the page"

  • How can I prevent Firefox from cleaning my clipboard at exit (exit or closing firefox) ?

    How can I prevent Firefox from cleaning my clipboard at exit (exit or closing firefox) ?
    I am using FF 9.0.1 and the problem start from FF 5.0

    You can't prevent that.<br />
    If you've placed data on the clipboard in Firefox then you need to paste that data in the other program, if that is your intention, before closing Firefox.

  • Adobe Reader Updater has been 'downloading' for over a week now...it is preventing me from signing out and closing my mini Mac, can't close down.  The window will not close ever, just keeps spinning around...help!

    How can I stop the 'Adobe Reader Update' from constantly trying to download?  It's been over a week now, preventing me from signing out of my computer and other issues too. Can you help please? thanks!

    Hi! The version is OS X 10 8 5...not sure what that means lol but it makes a difference obviously! 
    I did what  you said now and it has worked, thanks so very much for getting back to me.  I really appreciate your help!!
    Can I ask you questions in the future or do I just do that through the forum?\
    Thanks again, Jennie 
          From: Anubha Goel <[email protected]>
    To: rubyrose1950 <[email protected]>
    Sent: Sunday, April 26, 2015 10:42 PM
    Subject: You have been mentioned by Anubha Goel in Re: Adobe Reader Updater has been 'downloading' for over a week now...it is preventing me from signing out and closing my mini Mac, can't close down. The window will not close ever, just keeps spinning around...help! in Adobe Community
    |
    You have been mentioned
    by Anubha Goel in Re: Adobe Reader Updater has been 'downloading' for over a week now...it is preventing me from signing out and closing my mini Mac, can't close down. The window will not close ever, just keeps spinning around...help! in Adobe Community - View Anubha Goel's reference to you  Hey rubyrose1950, Could you please let me know what version of OS are you working on.You might try uninstalling Reader and install it again from the below mentioned link:Adobe Acrobat Reader DC Install for all versions Let me know how it goes. Regards,Anubha 
    Participate in the conversation by replying to this email
    To stop receiving these messages whenever you are mentioned, go to your preferences and disable notifications for direct social actions. |

  • Prevent Ctrl-W from closing Full Acrobat Search window

    When I do a Full Acorbat Search on a folder tree, it can take quite some time for all the hits to be found, and quite some time to work through the hits.  Usually, multiple PDF files are opened as I work through the hits.  As I close the PDFs with ctrl-W, it is very easy to accidentally close the Full Acrobat Search window, which means waiting forever to re-do the search and find my way to my current spot in the list of hits.  I find it highly inappropriate for ctrl-W to close the Full Acrobat Search window in the same way that it closes PDF files.  It is especially risky in Windows 7, where the window frames are translucent and the window with the focus is highlighted in a way that makes it very difficult to distinguish from the windows without the focus.
    Is there a way to prevent ctrl-W from closing the Full Acrobat Search window?  I am using Acrobat Professional 8.

    Thanks, Dave.
    I'm finding other inconsistent behaviour that is exacerbating the problem. If I close the last PDF file with ctrl-W, the search window stays open.  If I close the last PDF file from the task bar, boom, the search window gets clobbered too, which entails another lengthy re-search.

Maybe you are looking for

  • Unable to delete photos from my ipad2 .

    I am unable to delete photos from my ipad2. I am able to select the photos to delete but when I press the red delete button nothing happens. Is anyone else having this experience? Is there a known problem. Is there a solution?

  • Change material description at plant level

    Hi, can material description be changed for  only one plant.

  • Example of Streams for Messaging?

    Does anyone have a list of setup steps (maybe scripts?) they would be willling to share that use streams to trap LCR DML changes on a table and place the messages in a queue that will be read by a Java (possibly JMS) process? All the examples I can f

  • How to solved RFC connection (EarlyWatch)

    Hi, I having problem in Solution Manager 4.0 (EarlyWatch Report) R/3 landscape (NDV,NQA,NPR) NDV and NPR does works fine and getting EWA everyweek which is schedule every week NQA does not work at all Screenshot here: http://www.flickr.com/photos/252

  • Populating an arraylist

    hi Everyone, I am finding it difficult to write this code....Can anyone help me out i have a DVDInfo.text file which contains the following text Donnie Darko/sci-fi/Gyllenhall, Jake Raiders of the Lost Ark/action/Ford, Harrison 2001/sci-fi/?? Caddy S