sigkill

Catching SIGTERM from alpine image

元气小坏坏 提交于 2021-02-07 20:24:07
问题 I was trying to catch SIGTERM signal from a docker instance (basically when docker stop is called) but couldn't find a way since I have different results for each try I performed. Following is the setup I have Dockerfile FROM gitlab/gitlab-runner:alpine COPY ./start.sh /start.sh ENTRYPOINT ["/start.sh"] start.sh #!/bin/bash deregister_runner() { echo "even if nothing happened, something happened" exit } trap deregister_runner SIGTERM while true; do sleep 10 done Now I build the docker image $

Difference between 'Killed' and 'Terminated'

别等时光非礼了梦想. 提交于 2020-05-23 04:16:28
问题 I was just testing kill switch flags with a sleeping process. First i tried killed it with -15 xtechkid@ubuntu:~/Desktop/expermiments$ ps cax | grep 10005 10005 pts/2 S+ 0:00 sh xtechkid@ubuntu:~/Desktop/expermiments$ kill -15 10005 And the process got terminated xtechkid@ubuntu:~/Desktop/expermiments$ sh testscript.sh This is a script which sleeps for few seconds .. Terminated Then i killed it with - 9 xtechkid@ubuntu:~/Desktop/expermiments$ ps -ef | grep testscript.sh xtechkid 10059 9852 0

SIGKILL init process (PID 1)

两盒软妹~` 提交于 2020-01-21 04:51:09
问题 I'm facing a weird issue regarding sending signal 9 (SIGKILL) to the init process (PID 1). As you may know, SIGKILL can't be ignored via signal handlers. As I tried sending SIGKILL to init, I noticed that nothing was happening; init would not get terminated. Trying to figure out this behaviour, I decided to attach myself to the init process with strace too see more clearly what was happening. Now comes the weird part. If I'm "looking" at the init process with strace and send it SIGKILL, the

Mysterious SIGKILL in iPad application running in the simulator

馋奶兔 提交于 2020-01-15 15:36:52
问题 My iPad application has recently been receiving mysterious SIGKILL signals while running in the iOS Simulator. It seems to happen within 2 minutes of application launch, but not every time. Does this backtrace indicate anything, or should I try removing things until I find the culprit? There are some components that could be involved; one example is that I recently integrated Crashlytics. Another example is I'm using CLGeocoder to plot a location on an MKMapView, which could explain why the

C++ : how to close a tcp socket (server) when receiving SIGKILL

元气小坏坏 提交于 2020-01-05 03:56:05
问题 How can I close a socket just before die? I have a service on linux that create a TCP server. Sometimes I have to restart it and I want that the socket is really closed. At the moment it hangs. I also know that SIGKILL can't be handled. Can anyone point me in the right direction? 回答1: The socket will be closed - the OS will automatically do this, see: Using SO_REUSEADDR - What happens to previously open socket? Instead of trying to handle SIGKILL, which won't work, solve the problem at start:

Return a list of running background apps/processes in iOS

只愿长相守 提交于 2019-12-28 02:13:11
问题 I'm working on a jailbreak app, and want to send SIGKILL messages to specific apps that may be running on a user's device (with their permission, of course). Google is not turning up anything for me. Is there a plist or array that keeps track of running processes? Thanks for any help you all can give, you're wonderful! 回答1: Make a sysctl API and retrieve the kinfo_proc structure http://fxr.watson.org/fxr/source/sys/kinfo.h?v=DFBSD. This struct has information about running processes.You can

Difference between exit and kill in C++

女生的网名这么多〃 提交于 2019-12-25 01:01:16
问题 I have written a signal handler to handle a SIG , and I want to kill the process if I get too many of it. So, which of the following code is better, or should I use them both? exit(-1); // or some other exit code kill(getpid(), SIGKILL); 回答1: Difference between exit and kill in C++ One difference is that kill function is not specified in the C++ standard library. It is merely specified in POSIX. exit is standard C++. Another difference is that kill(getpid(), SIGKILL) will cause the operating

python sigkill catching strategies

只谈情不闲聊 提交于 2019-12-23 08:04:44
问题 I was wondering if there was any way to catch the sigkill from the OOM killer. I have a task queue, and every so often a mammoth task is created that is killed by OOM. This: catch Exception as ex: # clean up! does not work, as SIGKILL can't be caught. So........is there ANY strategy to clean up after a SIGKILL? Can I fork, and watch the child process? If so, any resources opened by the child process would have to be known in advance by the parent? Or could I just do some version of ps -ef |

How to kill the management thread with C?

江枫思渺然 提交于 2019-12-18 17:33:05
问题 I have the following code. the build application is myprogram. If I launch myprogram and then killall myprogram and immediately after that I launch again myprogram then myprogram crash. the crash cause is due to that the management thread created by the first launch is not properly cleared before the second launch. so in the second launch whent myprogram try to create thread with the pthread and the old thread management is not removed yet so it causes a crash. Are there a way to kill the

standard output impact SIGKILL?

自作多情 提交于 2019-12-13 07:02:02
问题 I have a script to limit the execution time length of commands. limit.php <?php declare(ticks = 1); if ($argc<2) die("Wrong parameter\n"); $cmd = $argv[1]; $tl = isset($argv[2]) ? intval($argv[2]) : 3; $pid = pcntl_fork(); if (-1 == $pid) { die('FORK_FAILED'); } elseif ($pid == 0) { exec($cmd); posix_kill(posix_getppid(), SIGALRM); } else { pcntl_signal(SIGALRM, create_function('$signo',"die('EXECUTE_ENDED');")); sleep($tl); posix_kill($pid, SIGKILL); die("TIMEOUT_KILLED : $pid"); } Then I