0

I have a bash script running in the background and wanted to send the SIGRTMAX-9 signal to it.

SIGRTMAX-* case

Why kill command doesn't recognize the SIGRTMAX-9 signal?

╭─ /tmp/tmp.KHFbrCQhOB                                                        
╰─ kill -SIGRTMAX-9 $(pgrep bash)
kill: unknown signal: SIGRTMAX-9
kill: type kill -l for a list of signals

If I run the kill command with sudo:

╭─ /tmp/tmp.KHFbrCQhOB                                                        
╰─ sudo kill -SIGRTMAX-9 $(pgrep bash)
kill: invalid argument S

Usage:
 kill [options] <pid> [...]
 
 ...

 For more details see kill(1).

SIGRTMIN+* case

If I send the SIGRTMIN+3 it only works with sudo:

╭─ /tmp/tmp.KHFbrCQhOB                                                 
╰─ kill -SIGRTMIN+3 $(pgrep bash)     
kill: unknown signal: SIGRTMIN+3
kill: type kill -l for a list of signals
╭─ /tmp/tmp.KHFbrCQhOB                                                        
╰─ sudo kill -SIGRTMIN+3 $(pgrep bash)

╭─ /tmp/tmp.KHFbrCQhOB                                                        
╰─ echo $?                            
0

4
  • man kill is your friend. It will tell you how (and what) your version of kill supports. As for "why does it not support SIG<xyz>?", you will have to ask the author of your kill command, and ask them why--or ask them to include it in the next release.
    – C. M.
    May 11, 2021 at 20:04
  • @C.M. yeah, I read it before asking, thankfully I found the "error", it was a simple mistake, will be posting it as an answer soon, thank you!
    – gckida
    May 11, 2021 at 20:37
  • I am not certain which kill man page you have, but mine has the warning: NOTES Your shell (command line interpreter) may have a built-in kill command. You may need to run the command described here as /bin/kill to solve the conflict. making it clear. ;-) In either case, you can always use the numeric value instead of the symbolic name. Which is why I pointed you at the man page.
    – C. M.
    May 11, 2021 at 21:58
  • I just checked it again, and you're totally right!, I must have skipped the NOTES section, fool of me, thank you! d:-D
    – gckida
    May 11, 2021 at 22:30

1 Answer 1

0

I figured out the problem, simple as typing which kill it printed out kill: shell built-in command; the thing is that I was inside a zsh session, and it has a built-in kill command, I fixed it calling /bin/kill -SIGRTMAX-9 $(pgrep bash) instead of just kill -SIGRTMAX-9 $(pgrep bash).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .