Usually the parent shell guesses that the script is written for the the same shell (minimal Bourne-like shells run the script with /bin/sh, bash runs it as a bash subprocess). Neither SIGKILL or SIGTERM can be set up as a keyboard shortcut the way SIGINT is.Īll this is moot if your script doesn't contain a shebang line. You might want to try SIGTERM ( -TERM) before going for the kill. However, SIGKILL can't be trapped, and it is usually a last-resort option. One of the commands that the script launches may be trapping SIGINT, which is probably why Ctrl C is ineffective. You only need to stop the script if you can't open another terminal. INT is used to send SIGINT, and so this command is the equivalent of pressing Ctrl C on the terminal. In this case, to send a signal to process group created by test.sh, you'd do: kill -INT -17802 Where PID is the process ID of the script.Ĭonsider a script test.sh which launches some processes. For the kill command, process leader is denoted thus: kill -PID To send a signal to all processes in this group, you send it to the process leader. When a command is executed in a shell, the process it starts and all its children are part of the same process group (in this case, the foreground process group). One is to stop the script ( Ctrl Z), get the PID of the script and send SIGKILL to the process group.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |