Artificial intelligent assistant

Why is `sudo pkill -HUP -f "nginx: master process"` returning code 129 and no output I'm trying to trigger a reload of the Nginx master process by using `pkill` and `sudo`. The server reloads fine, but I was just curious if anyone knows why the command `sudo pkill -HUP -f "nginx: master process"` returns code 129? # Running as root $ pkill -HUP -f "nginx: master process" $ echo $? # Output is as expected: 0 # Running as a user (sudo is set to not prompt for a password) % sudo pkill -HUP -f "nginx: master process % echo $? # Output is weird (considering sudo should be passing along the return # code of the command it is executing): 129 Running on Ubuntu 12.04.1 LTS running on EC2 ... surprisingly Ubuntu 12.04.1 LTS running on a physical computer (not installed using cloud images) runs fine.

Usually, when the shell returns a status code above 128, it means that the process was killed by a signal. Subtract 128 to get the signal number. Your kill command was killed by signal 1, which is HUP.

`pkill` takes care never to kill itself. But it matched its parent, the `sudo` process.

There are several ways to avoid this:

* Use `pkill -x` to consider only exact matches and not substrings (recommended if possible, this is the best way to avoid spurious matches).
* Don't use the `-f` option.
* (Last resort) Write a pattern that doesn't match itself, e.g. `"[n]ginx: master process"`.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy be2238eac8c99df751087bd8fc19ff0e