1

I have loaded debian etch into my NAS and I am trying to use it to routinely extract information from a website. Since there are quite a lot of pages to download, I used the nohup command, like this:

nohup ./script.sh $

Then the script runs as expected, but suddenly I changed my mind and want to modifiy the script a bit before running it again. How can I terminate the script which is now running?

Thanks.

lokheart
  • 123
  • 1
  • 5

2 Answers2

4

You can find the pid of the script using:

ps aux|grep script.sh

Then kill it using

kill -15 <the pid>

This sends the SIGTERM signal to the process, which can be caught to allow clean (graceful release of system resources). Alternatively, you can use the SIGQUIT process with -3, which is capable if generating a core file (if you want one).

Dana the Sane
  • 828
  • 9
  • 19
3

nohup prevents the processes from receiving SIGHUP. So, you must use -15 (SIGTERM) or -9 (SIGKILL) with kill command.

quanta
  • 50,327
  • 19
  • 152
  • 213
  • SIGKILL should only be used as a last resort though, since system resources may not be freed http://www.gnu.org/s/hello/manual/libc/Termination-Signals.html – Dana the Sane Sep 07 '11 at 16:31