| | |
how to prevent user close window during script execution?
![]() |
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
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.
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)
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.
•
•
•
•
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?
You can use nohup as follows so your users can see the output of your script.
Shell Scripting Syntax (Toggle Plain Text)
nohup ./test.sh | cat
Last edited by Paul.Esson; Oct 25th, 2006 at 9:34 pm.
•
•
Join Date: May 2004
Posts: 178
Reputation:
Solved Threads: 10
If you don't want the user to notice the script running:
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.
Shell Scripting Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- How to call a ServerSide Script through Javascript (ASP.NET)
- Prevent a User From Running or Stopping a Scheduled Process in Windows XP (Windows tips 'n' tweaks)
Other Threads in the Shell Scripting Forum
- Previous Thread: Windows batch script
- Next Thread: How not to show messages?
| Thread Tools | Search this Thread |





