kill

PHP on a windows machine; Start process in background

狂风中的少年 提交于 2019-12-28 15:55:10
问题 I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script. Right now, I'm using: shell_exec($Command); The problem with this is it waits for the program to close. I want something that will have the same effect as nohup when I execute the shell command. This will allow me to run the process in the background, so that later in the script it can be closed. I need to close it because this script will run on a regular basis and

PHP on a windows machine; Start process in background

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-28 15:54:17
问题 I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script. Right now, I'm using: shell_exec($Command); The problem with this is it waits for the program to close. I want something that will have the same effect as nohup when I execute the shell command. This will allow me to run the process in the background, so that later in the script it can be closed. I need to close it because this script will run on a regular basis and

How can I stop a running MySQL query?

泄露秘密 提交于 2019-12-28 04:38:05
问题 I connect to mysql from my Linux shell. Every now and then I run a SELECT query that is too big. It prints and prints and I already know this is not what I meant. I would like to stop the query. Hitting Ctrl+C (a couple of times) kills mysql completely and takes me back to shell, so I have to reconnect. Is it possible to stop a query without killing mysql itself? 回答1: mysql>show processlist; mysql> kill "number from first col"; 回答2: Just to add KILL QUERY **Id** where Id is connection id from

Python: how to kill child process(es) when parent dies?

 ̄綄美尐妖づ 提交于 2019-12-27 11:04:44
问题 The child process is started with subprocess.Popen(arg) Is there a way to ensure it is killed when parent terminates abnormally? I need this to work both on Windows and Linux. I am aware of this solution for Linux. Edit: the requirement of starting a child process with subprocess.Popen(arg) can be relaxed, if a solution exists using a different method of starting a process. 回答1: Heh, I was just researching this myself yesterday! Assuming you can't alter the child program: On Linux, prctl(PR

Close Image with subprocess

我怕爱的太早我们不能终老 提交于 2019-12-25 08:49:24
问题 I am trying to open an image with subprocess so it is visible to the user, then close the image so that it disapears. This question has been asked before, but the answers I found have not worked for me. Here is what I have checked: Killing a process created with Python's subprocess.Popen() How to terminate a python subprocess launched with shell=True How can I close an image shown to the user with the Python Imaging Library? I need the code to open an image (with Preview (optional), default

How to Kill Processes in Bash

心不动则不痛 提交于 2019-12-25 06:30:44
问题 I used the following bash code: for pid in `top -n 1 | awk '{if($8 == "R") print $1;}'` do kill $pid done It says: ./kill.sh: line 3: kill: 29162: arguments must be process or job IDs ./kill.sh: line 3: kill: 29165: arguments must be process or job IDs ./kill.sh: line 3: kill: 29166: arguments must be process or job IDs ./kill.sh: line 3: kill: 29169: arguments must be process or job IDs What causes this error and how do I kill processes in Bash? 回答1: Probably this awk command is not

iPhone - How to catch if the app is terminated (to update the badge icon)

人走茶凉 提交于 2019-12-25 03:35:00
问题 I'm setting : - (void)applicationWillTerminate:(UIApplication *)application { [UIApplication sharedApplication].applicationIconBadgeNumber = 1; } in my application delegate but the badge is never updated... What can be the problem ? How may I do to update that badge when the app is killed (phone shutdown, taskbar app kill, app killed by the system because of a memory overload, ...) ? 回答1: When your app is terminated in the background, it does not get an opportunity to clean up after itself.

jQuery window.location.replace keeps looping

本秂侑毒 提交于 2019-12-25 02:19:01
问题 I'm using window.location.replace() with jQuery to redirect to a new page in wordpres if you got a older browser in either Internet explorer or Firefox due to my html5 layout. var browser = jQuery.browser; var version = browser.version.slice(0.3); if ( browser.msie && version != "10.0" && version != '9.0' ) { window.location.replace("http://crosscom.dk/update-browser"); } if ( browser.mozilla && version != "17.0" && version != '16.0' && version != '15.0' ) { window.location.replace("http:/

How do I schedule a process' termination?

两盒软妹~` 提交于 2019-12-24 18:43:25
问题 I need to run a process, wait a few hours, kill it, and start it again. Is there an easy way that I can accomplish this with Python or Bash? I can run it in the background but how do I identify it to use kill on it? 回答1: With bash: while true ; do run_proc & PID=$! sleep 3600 kill $PID sleep 30 done The $! bash variable expands to the PID of the most recently started background process. The sleep just waits an hour, then the kill shuts down that process. The while loop just keeps doing it

Work around ssh does not forward signal

雨燕双飞 提交于 2019-12-24 12:05:51
问题 How can I work around the problem that ssh does not forward the SIGTERM signal? I want print-signal.py to terminate of the ssh root@localhost process terminates: ssh root@localhost /root/print-signal.py Unfortunately only the ssh process itself gets the signal, not the remote command ( print-signal.py ). The remote command does not terminate :-( Since openssh does not forward the SIGTERM to the remote command, I am searching for a work-around. How to terminate print-signal.py if ssh root