Questions tagged [kill]

1

votes
2

answer
195

Views

sudo ignores SIGTERM sent from same script

I'm trying to figure out why this doesn't work: #!/bin/bash sudo sleep 60 & sudo_pid=$! sudo kill $sudo_pid I'd expect that after the kill, the sudo command and its child sleep process would be terminated, but they aren't, as shown by this script: #!/bin/bash sudo sleep 60 & sudo_pid=$! sudo kill $s...
Jon
1

votes
2

answer
51

Views

I want to output “<PID> Killed ~” to logfile when it kill -9 <PID>

I want to output this message /usr/local/ex1.sh: line xxx: Killed ex2.sh >> $LOG_FILE 2>&1 to logfile. however The "ex1.sh" output /usr/local/ex1.sh: line xxx: Killed ex2.sh >> $LOG_FILE 2>&1 to console when I executed ex1.sh in console. The result that i want is that "ex1.sh" output to file, not...
Sh.nakayama
1

votes
2

answer
1.5k

Views

Is there anyway to “kill” system process by Visual Basic .NET 2008?

I tried a lot of ways to stop a system controlled process, tried google and even tried admin rights, or using C:\Windows\System32\taskkill.exe. It's very easily done in Task Manager, but didn't find a way to do this by programming if there's a way in VS.NET not in Basic or 2008 say it.
ahmadmanga
1

votes
4

answer
2.7k

Views

Jenkins job to kill process (Tomcat) over ssh

I am using a Jenkins job to run a few simple shell commands (over ssh, via the Jenkins SSH Plugin); the commands are supposed to shut down a running Tomcat server: sudo /opt/tomcat/bin/catalina.sh stop ps xu | awk '/[t]omcat/{print $2}' | xargs -r kill -9 The job executes fine and does terminate th...
Eugen
1

votes
1

answer
989

Views

linux screen - kill only if it exists (jenkins job)

I'm configuring complex jenkins jobs using linux screens. To create a new screen I run: screen -md -S jenkins_job then goes some other work and finally to destroy existing screen I run: screen -S jenkins_job -X quit But it may happen in jenkins that the script will fail somewhere inbetween and abort...
ducin
1

votes
2

answer
1k

Views

Kill all processes using a list of pid's in python?

I have a list of strings which contains the pid's to certain processes which must be killed at a certain time. pidList = ['1234', '1235', '1236'] How would one run through the list first casting all elements to int, then killing the process represented by that pid? essentially doing this: os.kill(i...
user2497792
1

votes
1

answer
1.1k

Views

Kill process by ppid in python?

In python using: os.kill() will kill a process by pid using a specified signal, How would one go about killing all processes with the same ppid?
user2497792
1

votes
2

answer
734

Views

detect a not responding thread and terminate it?

Sometimes the background thread runs slow and goes like, not responding, responding, not responding ... Is it possible to detect that and then terminate it and then restart it? I make the threads like this. the Form3 just contains a web browser control which only navigates and search the web documen...
user2725580
1

votes
4

answer
3.7k

Views

Android killing Process using only PS and GREP in shell script

I really need help here... I am writing a shell script, which starts a process then kills it every 10 seconds then restarts it again. I understand that using 'ps' command will show all the processes that are running and you can kill it by running 'kill [pid]'. However, grepping the PID of the proces...
janggirl
1

votes
2

answer
1.3k

Views

Parent process killing child process in infinite loop

To solve my problem, I set prctl(PR_SET_PDEATHSIG, SIGHUP); as in stackoverflow answer before i called exec*, and took out the part where we pipe the PID. It works!!!!! Wow.... HOWEVER, stackoverflow won't let me say I've answered my own question yet... So I tried to write a program, which I want t...
my name is aj
1

votes
1

answer
929

Views

Kill apache processes when memory usage reaches 90%

My situation is following: We run Magento Professional on a 15Gb ram instance, rackspace. When running htop, we could see that 'apache2 -k start' keeps spawning more child processes, someone them eats ~900Mb of memory. When memory is almost used up, all sites time out or become very slow. When memo...
ALAN VO
1

votes
1

answer
165

Views

Bash script start program and quit on given time

I'm trying to make a script that will run a program on parameter. When the program has been executed for 1 minute the program will exit. My code looks like this: pid=$(pidof $1) true=1 $1 while [ $true = 1 ] do time=$(ps -p $pid -o etime=) if $time > 01:00 then true=0 kill -9 $pid echo "The proces...
kiraitach
1

votes
1

answer
239

Views

Why doesn't the java process exit after kill -15?

I kill the java programm by kill -15 $PID, and from the log I find the ShutdownHook is called and finished. But the process is still running. So I dump the threads and find most of the are daemon thread, but the following: [[email protected] tesla]$ grep prio stack | grep -v daemon "Destro...
qiuxiafei
1

votes
3

answer
2.3k

Views

How do I stop a signal from killing my Bash script?

I want an infinite loop to keep on running, and only temporarily be interrupted by a kill signal. I've tried SIGINT, SIGUSR1, SIGUSR2. All of them seem to halt the loop. I even tried SIGINFO, but that wasn't supported by Linux. #!/bin/bash echo $$ > /tmp/pid # Save the pid function do_something { e...
Paolo
1

votes
1

answer
267

Views

Using X11 clipboard in Emacs instance inside gnome-terminal

I am using Emacs 24.5.1 from the Gnome Terminal in Arch Linux. When I copy text from outside the Gnome Terminal window (from any other X window, e.g. Firefox), it is not available in the Emacs kill-ring. I have tried (setq x-select-enable-clipboard t) to no avail. I have also tried this solution, wh...
dpc
1

votes
1

answer
998

Views

what Process.killProcess(android.os.Process.myPid()) do?

I'm developing android SDK for many apps to use it. In this SDK I use this line of code android.os.Process.killProcess(android.os.Process.myPid());. In one of my activities and it removes all the background processes and saved data in application class but I handled it in the SDK, but does this line...
Marcel Adel
0

votes
0

answer
7

Views

Cannot find daemon after daemonizing python script

I daemonized a python script using the daemonize python library, but now I cannot find the daemon that it spawned. I want to find the daemon and kill it to make some changes to the script. I used the following to daemonize: pidfile='/tmp/filename.pid' daemon = Daemonize(app='filename',pid=pi...
Blade_Runner
2

votes
2

answer
2.3k

Views

How to kill a java process (by name) in Windows' cmd.exe?

When I run jps -lv, I get 4748 org.apache.abc.runtime.common.abc -XX:PermSize=128m -XX:MaxPermSize=128m -Xmx512m -ea -Dproc_abc 11140 sun.tools.jps.Jps -Dapplication.home=C:\Program Files\Java\jdk1.7.0_79 -Xms8m I need windows batch command to kill abc. In linux, taskkill /f /pid $(jps -lv | grep...
이동준
1

votes
2

answer
3.1k

Views

I can´t kill my python script in linux

I'm trying to kill my python process and always still there. Also try using sudo and if I use top comand, the process is still there. The python script was created by me, and no other process is continually calling. [email protected]*******:~/Desktop/Servidor$ pkill python -e python killed (pid 1284) ubunt...
user2983041
2

votes
0

answer
26

Views

TERM trap doesn't reliably kill backgrounded sleep process

I wrote some BASHscript that shows a spinner and noticed that sometimes after the background process would finish and I killed the spinner, the sleep process was still running and delaying processing. I reduced the code to the one below: #!/bin/bash trap 'rm deleteme.fifo' EXIT mkfifo deleteme.fifo...
mleise
2

votes
2

answer
988

Views

Kill Bash copy child process to simulate crash

I'm trying to test a Bash script which copies files individually and does some stuff to each file. It is meant to be resumable, so I'd like to make sure to test this properly. What is an elegant solution to kill or otherwise abort the script which does the copying from the test script, making sure i...
l0b0
3

votes
1

answer
327

Views

Why does explorer.exe automatically restart when I user process.Kill() C#? [duplicate]

This question already has an answer here: Problem with Killing windows explorer? 5 answers I wrote this little function that searches for a process by name and kills it: see code below Process[] procList = Process.GetProcesses(); RegistryKey expKey = Registry.LocalMachine; expKey = expKey.OpenSubKe...
user3038431
1

votes
2

answer
2.3k

Views

Scala - How to stop a futures executed with a akka scheduler

this is my first time asking a question here and I am relatively new to scala. I have the following chunk of code: implicit val context = ExecutionContext.fromExecutor(Executors.newSingleThreadExecutor()) val system = ActorSystem("My System") val update = future { def doSomething(args...) = { // Do...
Flash Death
1

votes
3

answer
271

Views

Kill background processes in Linux

I'm trying to build a start script and a stop script for my project. I need to run a sass auto-compiler as well as a server, and redirect the output of both to a file. I'm using lite-server and sass --watch for this. To make these processes run concurrently, I'm using & to background the processes....
Luke Taylor
2

votes
1

answer
952

Views

How to kill several child processes spawned from same parent?

For testing purpose I am running several (few 100s) expect scripts. All are spawned from the same parent (sometimes its pid is 1). Is there any way to kill them at one stretch without changing their source code and without killing the parent process itself ? Something like: [[email protected] expect_sc...
iammilind
3

votes
3

answer
3.2k

Views

Open and then kill child process from bash

What's the best way of executing a command and then killing it after some time? Here's what I have; it does the job, but I get amp: command not found and although I'm not sure why the amp is there in the first place, I know that the killing doesn't work without it. feh "$output""$ext" & echo $! slee...
octosquidopus
16

votes
5

answer
26.3k

Views

Kill or terminate subprocess when timeout?

I would like to repeatedly execute a subprocess as fast as possible. However, sometimes the process will take too long, so I want to kill it. I use signal.signal(...) like below: ppid=pipeexe.pid signal.signal(signal.SIGALRM, stop_handler) signal.alarm(1) ..... def stop_handler(signal, frame): prin...
user504909
17

votes
6

answer
32.6k

Views

How can I prevent my Android app/service from being “killed” from a task manager?

It is very important that my service stay running until someone with a password stops the service from my UI screen. My app runs great but it is designed to be turned on/off by parents (with a password) on their kids phones. I have managed to make everything work but the problem I'm having is that i...
Don
2

votes
1

answer
754

Views

Kill/Debug own process from command line without root access

I run at tablet own application. Sometimes I want stop or enable debug process: How I can this without root access from command line? Now I can stop process, but only with root access: adb shell "su -c 'killall com.my.package'"
Yura Shinkarev
2

votes
1

answer
3.3k

Views

ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#

I'm new to C#, RestSharp, and threading, so heres what I'm trying to do: I have made a program that will allow me to upload photos to tumblr, and I have the uploading working so far. Now I need the stop button to work, which I believe means I must use ExecuteAsync() instead of Execute(). I also hav...
Anteara
1

votes
1

answer
2.1k

Views

How to force kill another application in cocoa Mac OS X 10.5

I've this task, from my application i need to kill another my application, the problem is that the other application has a Termination Confirm Dialog (there is no critical data to save, only confirmation of user intent to quit). On 10.6+ you will use: bool TerminatedAtLeastOne = false; // For OS X >...
Shebuka
3

votes
3

answer
1.3k

Views

Sort PS command by etime

So I am trying to develop a script that will find specfic processes, and kill the one that has been running the longest. Trying to get the command sorted by elapsed time is becoming the issue. Here is the command i am running, i know there are lots of | and likely a cleaner why to do all this, but...
Deldran
18

votes
3

answer
36.5k

Views

How to find MySQL process list and to kill those processes?

I'm facing issue, that MySql database hang, due to some queries. How can I found the process list, and process ids of MySql and kill them ?
Ashish Dadhich
1

votes
2

answer
1.4k

Views

Linux kill() error unexpected

Kill(pid, 0) seems to not set the error code correctly...as stated in man for kill Errors The kill() function shall fail if: EINVAL The value of the sig argument is an invalid or unsupported signal number. EPERM The process does not have permission to send the signal to any receiving process. ESRCH...
JonH
18

votes
4

answer
36.5k

Views

How to kill an open process on node.js?

I'm trying to set up a build-system for Node.js on sublime, so I can press F7 to call "node" on the openned file. The problem is that the process is then open forever, so, the second time I use F7 I get an add-in-use. Is there a way I can kill the openned "node.exe" process from node.js?
MaiaVictor
18

votes
8

answer
29.5k

Views

C# Process Killing

I need to write a program in c# that would just start, kill one process\exe that it is supposed to kill and end itself. The process I need to kill is another C# application so it is a local user process and I know the path to the exe.
Moon
19

votes
3

answer
19.4k

Views

Java program terminate with java result: 137

I have a program written in netbeans. The program read about 1,000,000 data from cassandra, process them and again write the result in cassandra. my program was running bout 9 hours but suddenly it was terminate with this bellow error: java result: 137 I was read that these error means (128 + signa...
Anse danesh
5

votes
1

answer
4.5k

Views

how to kill a process group using Python subprocess

I am trying to do the equivalent of the following using Python subprocess: >cat /var/log/dmesg | festival --tts & [1] 30875 >kill -9 -30875 Note that I am killing the process group (as indicated by the negative sign prepending the process ID number) in order to kill all of the child processes Festiv...
d3pd
3

votes
3

answer
324

Views

Automating Killall then Killall level 9

Sometimes I want to killall of a certain process, but running killall doesn't work. So when I try to start the process again, it fails because the previous session is still running. Then I have to tediously run killall -9 on it. So to simplify my life, I created a realkill script and it goes like th...
Sepero
4

votes
3

answer
250

Views

Perl fails to kill self pid when running from bash script

Following code behaves as expected when running from terminal: perl -e 'kill -2, $$; warn HERE, $/' It sends itself SIGINT and dies before reaching "HERE": ~# perl -e 'kill -2, $$; warn HERE, $/' ~# echo $? 130 ~# The problem: same code fails to kill self PID when running from shell script: ~# cat 1...
MrCricket

View additional questions