Questions tagged [sigterm]

SIGTERM is one of the POSIX mandated signals; it indicates that the process should terminate, which is also the default action for SIGTERM.

238 questions
3
votes
1 answer

To What Extent Can One Rely on Writing to Disk When SIGTERM is Given?

I am developing for Linux and have a daemon that should write to disk when it is killed. The daemon could be configured to listen to SIGTERM and write to disk when that signal is received. I am also familiar with the PrepareForShutdown D-Bus signal…
3
votes
3 answers

PID files hanging around for daemons after server restart

I have some daemons that use PID files to prevent parallel execution of my program. I have set up a signal handler to trap SIGTERM and do the necessary clean-up including the PID file. This works great when I test using "kill -s SIGTERM #PID". …
stinkypyper
  • 2,008
  • 4
  • 22
  • 29
3
votes
0 answers

Debug TV resolution switch

I want to write an iPad application that uses extern TV. To detect external displays, I use the recommended code: - (void)viewDidLoad { [super viewDidLoad]; // ... [[NSNotificationCenter defaultCenter] addObserver:self…
Matthias
  • 8,018
  • 2
  • 27
  • 53
3
votes
1 answer

SIGTERM Handler called multiple times

I'm doing something like this def exitHandler(self, *args): self.stopThreads() sys.exit(2) and I register that function in my self.run (working with a daemonized programm) signal.signal(signal.SIGTERM,…
Kai
  • 2,205
  • 3
  • 32
  • 43
3
votes
0 answers

Handling Signal Sent by "Stop" While Running Debugger in QT Creator

While running my program normally in QT Creator (on a Linux machine), when I hit the "stop" button, I am able to handle the SIGTERM signal and gracefully shut down my software. However, when I run in debug mode and hit the same button, no signal…
user985030
  • 1,557
  • 1
  • 16
  • 32
2
votes
2 answers

Installing SIGTSTP Foreground Process

I am trying to install a CTRL-Z (SIGTSTP) handler for a running foreground process. I set the handler (sigaction) right before I wait in the parent. Is this the right place? It doesn't seem to work right.. EDIT: I am writing a shell. Here is an…
darksky
  • 20,411
  • 61
  • 165
  • 254
2
votes
1 answer

after kubernetes preStop hook, is terminationGracePeriodSeconds still honored?

I have a preStop hook for my pod that sends TSTP signals to each process, and waits for their completion, but only to a maximum of 60 seconds. Let us say that we set terminationGracePeriodSeconds to 3600 seconds. After the completion of the preStop…
2
votes
1 answer

How to wait for a non-child process?

Currently I do: while [ -d "/proc/$PID" ]; do sleep 1 done Since I cannot use wait as it is a non-child process. The problem is that sleep blocks any signal trap handlers (for example for SIGINT or SIGTERM) until it is not sleeping anymore. So…
Maestro
  • 9,046
  • 15
  • 83
  • 116
2
votes
1 answer

Docker container script returned exit code 143 while container is still running

I run into a situation when Jenkins deployment broke with + docker run --name planning_31_deploy_prod --rm fd1c9016 sh -c 'npx sls config credentials --stage prod --provider aws --profile prod --key **** --secret **** && npx sls deploy --force…
Roman Newaza
  • 11,405
  • 11
  • 58
  • 89
2
votes
1 answer

Conventional practice for signal handling/child processes

EDIT: If managing child processes for a shell script is really purely a matter of "opinion"......no wonder there are so many terrible shell scripts. Thanks for continuing that. I'm having trouble understanding how SIGTERM is conventionally handled…
Paul Draper
  • 78,542
  • 46
  • 206
  • 285
2
votes
0 answers

In windows container, how to graceful shutdown asp.net core application?

In windows container, how to graceful shutdown asp.net core application? I want use external process(ex: bash,powershell,dotnet core console application) to update my external module dll(be using by Assembly.Load). So I need to stop my application…
2
votes
1 answer

Kubernetes delete deployment signal

I have the following python code: import time import os import signal from abc import abstractmethod class Stopper: stop = False @staticmethod def safe_stop(*args): Stopper.stop = true signal.signal(signal.SIGINT,…
Mar Teen
  • 87
  • 1
  • 11
2
votes
0 answers

Descendent of a child process not receiving SIGTERM on ubuntu but receives on mac

So I have some code which runs a command in a spawned child process. I do this using the execa module. const childProcess = execa.command('yarn start'); const localhostStarted = await waitForLocalhost({ port: 8000 }); …
2
votes
1 answer

Why SIGTERM event handler wasn't called in my code example?

Windows 10 x64 Node v12.19.0 Why wasn't called my handler of SIGTERM event after first opening http://localhost:3000/ in a browser? Application is terminated without executiong my handler (I don't see its console output). // node v12.19.0 const http…
Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
2
votes
1 answer

child_process didn't receive SIGTERM inside docker container

I'm writing test for electron application in typescript. Inside application there are register listener for SIGTERM process.on('SIGTERM', async () => { console.log('before exit'); await this.exit(); //some inner function can't reach…