Questions tagged [pkill]
The pkill tag has no usage guidance.
18
questions
7
votes
1answer
34k views
How to kill all processes owned by `user` on Centos 7? [duplicate]
I read in an online flash card that the command is:
pkill -u bob $(pgrep -u bob)
However, I think this is wrong. I think it's saying:
Kill all the processed owned by bob, and 4572\n4600
Because:
...
5
votes
4answers
3k views
How to stop a script within another script
I'm running Ubuntu 16.04, using a terminal emulator.
I have two scripts: a.sh and b.sh.
a.sh calls b.sh.
a.sh
echo "a is running"
sleep 5s
bash b.sh
sleep 5s
echo "a is still running"
b.sh
echo "...
3
votes
2answers
1k views
Kill process by name
I am using bash to start several instances of one python program, like this:
python example.py -id $i
where $i is the id given to the instance. All the processes are started on the same user, and ...
1
vote
1answer
346 views
How to get pkill to output process information of killed process?
How to get pkill to output process information of killed process?
I don't see anything in man pkill that suggests this is possible. I know I can do a pgrep and process the list and then pipe that to ...
1
vote
1answer
134 views
Tagging a process so I can kill it later easily by identifying
I need to tag a generic process (I don't really control the command being run).
Could I do something like this:
run_special_cmd(){
"$@" -- --very-special-command
}
run_special_cmd sleep 5000 &...
1
vote
1answer
59 views
Why pkill return -9?
I want to run command pkill -9 -f 'java.*7104' in python3 use subprocess.run, but I do not know why returncode=-9, can anyone explain this?
>>> subprocess.run("pkill -9 -f 'java.*7104'", ...
1
vote
1answer
9k views
How to force a PID to terminate? [duplicate]
Yes, I've tried all the basic kill, pkill, etc. methods that come up with a Google search.
Sometimes it works, other times it seems something is preventing the process from terminating.
There is no ...
1
vote
1answer
603 views
MacOS: su pkill -9 “process_name” = sorry
How to use pkill as su on a Mac?
When I run su pkill -9 "RFBEventHelperd" in the terminal I get su: Sorry (but works as sudo). I am looking for a way to kill this process from inside a script that ...
1
vote
1answer
40 views
Process is running [closed]
I have run the following command as root today morning sh /home/suio/LoadSnortSingature.sh > /home/suio/logs.txt 2>&1 after some time the session of the terminal closed and I have relogged in ...
0
votes
1answer
1k views
What is the `-KILL` option in `pkill` command
I have found a way to logout any user by using the command line. By executing the command pkill -KILL -u <username>, I can now log myself out from the session I have entered.
My question is ...
0
votes
1answer
29 views
How to kill the PID of service that configured as Restart=always
Dear friends and colleges ,
We have service under /etc/systemd/system
Service name is calc_live_servers.service
Since Restart=always is configured in calc_live_servers.service
Then when we kill ...
0
votes
1answer
2k views
pkill does not work on Ubuntu 16.04
I list all the processes in the system using ps -aux
and I found this java process:
10253 2.1 10.1 3259172 398864 pts/0 Tl 06:58 0:09 java -jar /opt/can-peris/core-price-update/menu-core-...
0
votes
2answers
217 views
would like to suppress the output of pkill on a background process
I have a shell-script in which I do an
iostat -c 1 > data.cpu. &
Later in the script, after I've collected the data I'm interested in, I do a
pkill iostat
which kills iostat and allows me ...
0
votes
3answers
735 views
pkill -P variable not working when running .sh under cron
I have a very simple .sh script to kill a process. The processes saves its PID to pid2.txt.
pkill -e -P $(cat pid2.txt)
exit
When I run this as sudo ./myscript.sh from the command line it works fine....
0
votes
2answers
848 views
Using `pgrep` to emulate `ps -ef` for use in a `for i in` loop
Ubuntu 16.04
I am used to using this command line to kill any process match said COMMAND
for i in $(ps -ef | grep COMMAND | awk '{ print $2 }'); do kill -9 "$i" &>/dev/null;done
shellcheck ...
0
votes
1answer
37 views
How to forcefully close a ssh connection is the command on the target server never returns
I have an automation tool that generates and executes the below command that fires rpm -qa grep httpd on the target host 10.9.100.67.
ssh -vvv -o StrictHostKeyChecking=no -o 'IdentityFile="/app/...
0
votes
0answers
109 views
How to get cron to pkill my java process?
I have a cron job that runs to detect if a certain application has frozen. If so it should kill the frozen application and restart it. The application is a Java program. When the application is frozen,...
0
votes
0answers
19 views
Digital ocean server access issue
I have accidentally run command pkill -U root.
I was in root user..
now I am not able to access through ssh from my local system but I can access my server's terminal on my browser from my digitl ...