I am running a Linux program that uses a lot of memory. If I terminate it manually using Ctrl-C, it will do the necessary memory clean-up. Now I'm trying to terminate the program using a script. What is an elegant way to do so? I'm hoping to do something similar to Ctrl-C so it can do the memory clean-up. Will using the "kill -9" command do this?
Asked
Active
Viewed 176 times
0
-
2Don't do `kill -9`. That is extremely rude to the application. A normal `kill` should do what Ctrl-C does. – Thilo Nov 08 '16 at 09:05
1 Answers
3
What do you mean by memory clean-up? Keep in mind that memory will be freed anyway, regardless of the killing signal.
Default kill signal - SIGTERM (15) gives application a chance to do some additional work but it has to be implemented with a signal handler.

woockashek
- 1,588
- 10
- 25