kill

How should I clean up hung grandchild processes when an alarm trips in Perl?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 12:24:41
I have a parallelized automation script which needs to call many other scripts, some of which hang because they (incorrectly) wait for standard input or wait around for various other things that aren't going to happen. That's not a big deal because I catch those with alarm . The trick is to shut down those hung grandchild processes when the child shuts down. I thought various incantations of SIGCHLD , waiting, and process groups could do the trick, but they all block and the grandchildren aren't reaped. My solution, which works, just doesn't seem like it is the right solution. I'm not

How to get variable from text file into Bash variable

醉酒当歌 提交于 2019-12-03 11:39:58
问题 Simple question, in BASH I'm trying to read in a .pid file to kill a process. How do I read that file into a variable. All the examples I have found are trying to read in many lines. I only want to read the one file that just contains the PID #!/bin/sh PIDFile="/var/run/app_to_kill.pid" CurPID=(<$PIDFile) kill -9 $CurPID 回答1: You're almost there: CurPID=$(<"$PIDFile") In the example you gave, you don't even need the temp variable. Just do: kill -9 $(<"$PIDFile") 回答2: POSIX portable way: $

How to kill a process in cygwin?

不羁岁月 提交于 2019-12-03 10:37:08
问题 Hi i have the following process which i cant kill: I am running cygwin in windows xp 32 bit. I have tried issuing the following commands: /bin/kill -f 4760 /bin/kill -9 5000 kill -9 5000 kill 5000 When i write /bin/kill -f 4760 i get the message, 'kill: couldn't open pid 4760'. When i write /bin/kill -9 5000 i get the message, 'kill: 5000: No such process'. I simply don't understand why this process cant be killed. Since it has a WINID shouldnt it be killed by /bin/kill -f 4760? hope someone

The right way to kill a process in Java

ε祈祈猫儿з 提交于 2019-12-03 10:34:12
What's the best way to kill a process in Java ? Get the PID and then killing it with Runtime.exec() ? Use destroyForcibly() ? What's the difference between these two methods, and is there any others solutions ? Derlin If the process you want to kill has been started by your application Then you probably have a reference to it ( ProcessBuilder.start() or Runtime.exec() both return a reference). In this case, you can simply call p.destroy() . I think this is the cleanest way (but be careful: sub-processes started by p may stay alive, check http://bugs.sun.com/bugdatabase/view_bug.do?bug_id

why does android 'revives' crashing apps?

ぃ、小莉子 提交于 2019-12-03 07:44:46
if you have an android app that has more than one Activity, and Activity A starts B, so if Activity b crashes the process is killed but is revived by android OS and starts Activity A again instead of just shutting down the app, why ? You're complaining that Android will attempt to recover your app's state gracefully after a crash? ;) This is the result of Android's resource management and the Activity lifecycle at work. Keep in mind that a single task can be composed of a number of Activities that may span several processes or apps. As outlined here: http://android-developers.blogspot.com/2010

Opening/Closing application via .bat file [Windows]

风格不统一 提交于 2019-12-03 06:27:35
Good Day, I have a .bat file that run a specific application then after 5 seconds it will close/kill it. I having right now due to it successfully open the application thought when the app opens it will not execute the remaining commands unless I manually close the app. Here is my code: cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\" asperascp.exe sleep 5 taskkill /IM asperascp.exe /f I also try removing the sleep command. cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\" asperascp.exe taskkill /IM asperascp.exe /f But it will have same output it will not execute the remaining

When a parent process is killed by “kill -9”, will subprocess also be killed?

橙三吉。 提交于 2019-12-03 05:46:13
问题 One of my colleague told me this morning, when he killed supervisord by "kill -9", the subprocesses of supervisord is not killed. He is quite sure about that, but I tried many times and did not find that happen. So when a parent process is killed by "kill -9", will linux ensure that it's sub-processes also been killed? 回答1: You have to make the sub processes daemonic in order to have them killed when the father is killed (or dies), otherwise they are adopted by init(1). 回答2: No, child

Python: when to use pty.fork() versus os.fork()

南楼画角 提交于 2019-12-03 05:28:31
I'm uncertain whether to use pty.fork() or os.fork() when spawning external background processes from my app. (Such as chess engines) I want the spawned processes to die if the parent is killed, as with spawning apps in a terminal. What are the ups and downs between the two forks? The child process created with os.fork() inherits stdin/stdout/stderr from parent process, while the child created with pty.fork() is connected to new pseudo terminal. You need the later when you write a program like xterm: pty.fork() in parent process returns a descriptor to control terminal of child process, so you

The GNU screen is unresponsive, seems blocked

风流意气都作罢 提交于 2019-12-03 01:59:42
问题 GNU Screen seems to freeze. Unable to enter user input. I was using GNU screen and when I pressed the screen it became unresponsive. I can execute all the GNU screen commands, but can't enter user input. I don't want to kill this screen as I have important work and I don't want to lose it. 回答1: In the commands below, replace Ctrl with whatever your escape key is for screen commands. Try Ctrl + a q , which is the sequence to unblock scrolling. Ctrl + a s is the sequence that blocks scrolling,

How is it possible that kill -9 for a process on Linux has no effect?

99封情书 提交于 2019-12-03 01:09:54
问题 I'm writing a plugin to highlight text strings automatically as you visit a web site. It's like the highlight search results but automatic and for many words; it could be used for people with allergies to make words really stand out, for example, when they browse a food site. But I have problem. When I try to close an empty, fresh FF window, it somehow blocks the whole process. When I kill the process, all the windows vanish, but the Firefox process stays alive (parent PID is 1, doesn't