linuxpidwebfaction

Linux bash pidof command wont work


This is a minor error that I can't figure out. When I enter the pidof command to shut down a process, the command line just executes pidof and goes to the next line and nothing happens. No error message no nothing.

Example:

pidof supervisord

Solution

  • That's the expected behavior of pidof when it doesn't find any processes by that name.

    Also, it doesn't kill the process, just returns the process ID of it. You want to use "killall" to actually kill a process, or a combination of "pidof" to get the PID and "kill" to kill that PID.

    killall supervisord
    

    Or

    kill $(pidof supervisord)