I am trying to kill the processes below:
pi@raspberrypi ~ $ ps aux | grep raspi pi 4647 0.0 0.5 3520 1392 pts/2 S+ 12:05 0:00 grep --color=auto raspi root 8148 0.0 0.5 10744 1372 ? Sl 06:25 0:00 raspivid -w 800 -h 600 -t 15000 -o /home/pi/media/2015-02-01-06-25-03.177474.h264 -n -rot 270 pi 30099 0.0 0.6 11400 1748 pts/1 Sl+ 11:57 0:00 raspistill -o test.jpg I tried some commands as showed below but no success:
pi@raspberrypi ~ $ sudo pkill -f raspivid pi@raspberrypi ~ $ sudo pkill -f raspistill pi@raspberrypi ~ $ sudo kill 8148 pi@raspberrypi ~ $ sudo kill 30099 I am logged via SSH as the "pi" user, is it the source of issue? If yes, then why I can't kill my own process (30099)?
Am I missing something here?
2 Answers
The name of kill command family is misleading - they don't really kill anything, just send signals to processes. By default SIGTERM signal is sent, which only gently asks process to quit, but process can choose to ignore it or handle it differently. (see man page for kill).
To force-quit a process, you have to send it a SIGKILL signal. SIGKILL cannot be ignored by the process and in most cases results in its instant termination, without finishing tasks in progress etc.
There are few possible syntaxes to send SIGKILL, all of these are completely equivalent:
kill -9 <pid> kill -kill <pid> kill -s SIGKILL <pid> It's possible that process will be unkillable even with SIGKILL and reboot will be required.
I killed a python3 script that was started via rc.local with the command:
sudo killall python3 I first listed all running processes with the command:
ps -ef