•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 401,693 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,700 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 6990 | Replies: 7
![]() |
•
•
Join Date: Feb 2005
Location: Ballarat, Australia
Posts: 164
Reputation:
Rep Power: 4
Solved Threads: 6
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
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.
•
•
Join Date: Feb 2005
Location: Ballarat, Australia
Posts: 164
Reputation:
Rep Power: 4
Solved Threads: 6
•
•
Join Date: Feb 2005
Location: Ballarat, Australia
Posts: 164
Reputation:
Rep Power: 4
Solved Threads: 6
•
•
•
•
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.
nohup ./test.sh | cat
Last edited by Paul.Esson : Oct 25th, 2006 at 8:34 pm.
•
•
Join Date: May 2004
Posts: 177
Reputation:
Rep Power: 5
Solved Threads: 9
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.
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 5:27 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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: Help with reading file and splitting by delims
- Next Thread: Case insensitive 'sed' and 'tr'?


Linear Mode