how to prevent user close window during script execution?

Reply

Join Date: Aug 2005
Posts: 3
Reputation: rinque is an unknown quantity at this point 
Solved Threads: 0
rinque rinque is offline Offline
Newbie Poster

how to prevent user close window during script execution?

 
0
  #1
Aug 7th, 2005
As mentioned in the title.
I wrote a script that has pretty long execution time. Some user just close the window half way and in the end cause some file corrupted. Is there any way to prevent the user closing the window? (Like turn the 'x' button of the window title bar grey color?)
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Solved Threads: 16
shanenin shanenin is offline Offline
Posting Whiz in Training

Re: how to prevent user close window during script execution?

 
0
  #2
Aug 8th, 2005
echo "please do not close this window until promted, this may take awhile"

sorry, I was trying to be funny. I am not sure how to do waht you wnat.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 181
Reputation: Paul.Esson is an unknown quantity at this point 
Solved Threads: 10
Paul.Esson's Avatar
Paul.Esson Paul.Esson is offline Offline
Junior Poster

Re: how to prevent user close window during script execution?

 
0
  #3
Aug 8th, 2005
there is no real way to stop a user from closing a window using a shell script.

but if your worring about your shell script being half way through something when they close the window.

use

Shell Scripting Syntax (Toggle Plain Text)
  1. nohup

this makes the process not honour hang up signals

NOTE: you will no long output stuff to the tty, so if you want user imput its prolly best to do as follows, run a process asking for the imput without nohup then run another process accepting the input from the command line with nohup.


I havent checked this but you may also be able to run a function as nohup, I don't know.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 3
Reputation: rinque is an unknown quantity at this point 
Solved Threads: 0
rinque rinque is offline Offline
Newbie Poster

Re: how to prevent user close window during script execution?

 
0
  #4
Aug 9th, 2005
thanks for your reply!
but how about if the window is launched using 'cmdtool' command from the script itself? can closing this window be prevented? like disable the 'x' button?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 181
Reputation: Paul.Esson is an unknown quantity at this point 
Solved Threads: 10
Paul.Esson's Avatar
Paul.Esson Paul.Esson is offline Offline
Junior Poster

Re: how to prevent user close window during script execution?

 
0
  #5
Aug 18th, 2005
Im not to certain, would depend on your terminal. there might be a way of stopping ppl closing the window in certain terminals.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1
Reputation: hungtat is an unknown quantity at this point 
Solved Threads: 0
hungtat hungtat is offline Offline
Newbie Poster

Re: how to prevent user close window during script execution?

 
0
  #6
Oct 25th, 2006
Hi I know this post has not been updated for awhile, but I am facing the same exact problem like the original poster! Anyone knows of any update to this question?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 181
Reputation: Paul.Esson is an unknown quantity at this point 
Solved Threads: 10
Paul.Esson's Avatar
Paul.Esson Paul.Esson is offline Offline
Junior Poster

Re: how to prevent user close window during script execution?

 
0
  #7
Oct 25th, 2006
Originally Posted by hungtat View Post
Hi I know this post has not been updated for awhile, but I am facing the same exact problem like the original poster! Anyone knows of any update to this question?
I would still suggest using nohup atleast if the user closes the terminal you will still be processing.

You can use nohup as follows so your users can see the output of your script.

Shell Scripting Syntax (Toggle Plain Text)
  1. nohup ./test.sh | cat
Last edited by Paul.Esson; Oct 25th, 2006 at 9:34 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 178
Reputation: jim mcnamara is on a distinguished road 
Solved Threads: 10
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: how to prevent user close window during script execution?

 
0
  #8
Oct 26th, 2006
If you don't want the user to notice the script running:
Shell Scripting Syntax (Toggle Plain Text)
  1. nohup script.sh <parameters> 2>&1 > ./logfile &

As long as your script does not ask for user input this will work. Otherwise you will have to resort to nohup and an expect script or nohup and a here document.
Last edited by jim mcnamara; Oct 26th, 2006 at 6:27 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 1
Reputation: rashshell is an unknown quantity at this point 
Solved Threads: 0
rashshell rashshell is offline Offline
Newbie Poster

Re: how to prevent user close window during script execution?

 
-1
  #9
Aug 25th, 2009
I had the same issue, but what i did is i just put time and refresh it every minute or so.
this way the user knows something is happening
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC