Linux bash pidof command wont work
-
03-07-2021 - |
Frage
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
Lösung
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)
Andere Tipps
Pidof looks at the process list in the following way
root 526 0.9 0.0 56556 11788 ? Ss Sep19 89:39 /usr/bin/python
/usr/bin/supervisord
So,
# pidof python
526
Try
pgrep -f "supervisord"
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow