1
vote
0answers
65 views

Kill Command in linux using bash script [migrated]

I have a bash script abcd.sh,in which I want to kill this command(/usr/local/bin/wrun 'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat') after 5 sec but in this script it kill sleep command after 5 ...
5
votes
3answers
227 views

Using `kill -s 0 $pid` vs `[[ -e /proc/$pid ]]` to detect if PID is running

One of the idioms often used to check if process is running is to use kill -s 0 $pid. My question is, does it have any upsides over using [[ -e /proc/$pid ]] construct? The script I'm writing is ...
1
vote
2answers
63 views

"trap 'killall $$ ; rm -f $folder2;exit ' 18 20 24

What is wrong with this command? $ trap 'killall $$ ; rm -f $folder2;exit ' 18 20 24 That command is in a for loop, and while that for is executing, if I press CTRL-Z I want it to stop the process ...
1
vote
2answers
150 views

xargs inside a for loop

So we got most of it figured out but here's what happens. for i in $(arp |sort |awk '{print $1}'|grep IPADDRESS) do ssh USERNAME@$i "ps -ef |grep X11|grep -v grep |awk '{print $2}'|xargs kill" done ...
1
vote
2answers
181 views

How do I kill all screens?

I accidentally created over 1000 screens. How do I kill them all with one command? (Or a few)
0
votes
0answers
66 views

cabal dies on NixOS in KVM

I set up a NixOS system on KVM and installed the haskelPlatform package. Everything works fine, ghci works fine, but cabal dies without any helpful error message: [michas@nix:~]$ type -a cabal cabal ...
4
votes
3answers
641 views

What's the difference between pkill and killall?

I know that pkill has more filtering rules than killall. My question is, what is the difference between: pkill [signal] name and killall [signal] name I've read that killall is more effective ...
3
votes
3answers
296 views

timeout without killing process in bash

I have a main script that I'm running, and from it I have a second "slow process" I want to kick off, and "do something" in the main script if it doesn't complete in the time limit -- depending on if ...
2
votes
4answers
817 views

How to kill a process which can't be killed without rebooting?

There are 5 processes which can't be killed by kill -9 $PID and executing cat /proc/$PID/cmdline will hang the current session. Maybe they're zombie processes. Executing ps -ef or htop will also hang ...
5
votes
2answers
385 views

My process was killed but I cannot understand the kernel notice

I have a custom application running on an embedded x86 setup (built using buildroot and uClibc). The application has been running fine but this morning when I returned to work I discovered my process ...
6
votes
2answers
184 views

Decode Flags for Kill Command

I am new to Shell Scripting. I saw this Command on a Book for Linux shell Scripting $ kill -HUP 1234 >killout.txt 2>killerr.txt I know what the command does, but i am not able to understand ...
5
votes
3answers
345 views

What did I just kill?

Is there any way to find out what I just killed? $ ps -A -o pid,cmd | grep someApp | grep -v grep 2802 python someApp.py $ sudo kill 2302 $ EDIT: To clarify, I need to know what PID 2302 was before ...
2
votes
1answer
32 views

Mediastream goes defunct

I am running my donnet framework based application using mono in Linux Ubuntu. My application uses linphone's mediastream command to open the RTP socket and hook the audio device. I am using the ...
3
votes
1answer
876 views

Cannot kill a java process

I have a java process that cannot be killed. I have tried every method I know, or that I have found on the internet to no avail. I have tried: killall java kill -9 <pid> kill -11 <pid> ...
3
votes
1answer
444 views

Can't kill process, not in zombie or uninterruptable sleep [closed]

I can't figure out how to kill this process. I ran du, but it took too long so I tried to kill it. It didn't die. I've tried SIGKILL, SIGSTOP, SIGINT, etc, with no effect (can't kill it, can't stop ...
3
votes
2answers
673 views

How can I kill the top CPU/IO process quickly?

I find that sometimes my Linux will stop responding, so I need to switch to another terminal with CtrlAltF2, and type a command to kill the top CPU usage process or top IO usage process, so that the ...
1
vote
2answers
840 views

Kill all processes related to an application

I have two processes that are temporarily spawned and I need to kill them. Here are the processes from ps aux david 38329 0.0 5.0 3916476 104624 s002 S 11:33AM 0:17.43 ...
7
votes
3answers
2k views

Linux: Kill process based on arguments

How can I kill a process based on its command line arguments? killall, pgrep, and pkill seem to only work based on the process name. I need this to be able to differentiate between a number of ...
2
votes
2answers
318 views

Is there a log of past threads that are now closed?

Sometimes, I have a rogue Java process which takes up 100% of my CPU and makes it jump about 30C in temperature (usually resulting in a crash if not killed). Problem is, I can never really identify ...
7
votes
3answers
898 views

How to stop a bunch of processes on unix fast?

How to stop a bunch of processes on unix fast. I can use ps/top, kill. If the number of processes is very large, I use shell script. Are there other ways, only one or two unix commands can do it ...
1
vote
2answers
982 views

Is it possible to kill another user's program? How?

root can kill any program run by any user. Is it possible for a user to kill another user's program without using sudo, etc.? Example: How can make user foo kill program x which is run by user bar?
6
votes
2answers
3k views

killall gives me `no process found ` but ps

Could somebody explain to me the difference between kill and killall? Why doesn't killall see what ps shows? # ps aux |grep db2 root 1123 0.0 0.8 841300 33956 pts/1 Sl 11:48 0:00 ...
15
votes
3answers
11k views

Where can I see a list of kernel killed processes?

Is there some way I can check which of my processes the kernel has killed? Sometimes I log onto my server and find that something that should've run all night just stopped 8 hours in and I'm unsure if ...
167
votes
7answers
72k views

When should I not kill -9 a process?

I am always very hesitant to run kill -9, but I see other admins do it almost routinely. I figure there is probably a sensible middle ground, so: When and why should kill -9 be used? When and why ...