A signal is a message which can be sent to a running process. Signals can be initiated by programs, users, or administrators.

learn more… | top users | synonyms

15
votes
2answers
1k views

Why can't I kill a SIGSTOP'd process with a SIGTERM?

I am using Debian stretch (systemd). I was running the rsyslog daemon in foreground using /usr/sbin/rsyslogd -n and I did a Ctrl+Z to stop it. The state of the process changed to Tl (stopped, ...
0
votes
1answer
28 views

Order of signals: SIGPOLL and SIGCHLD

I spawn a child process and connect to it with a pipe. I configure the pipe to send SIGPOLL on data available by fcntl I_SETSIG. The child sends some data over the pipe and then terminates. Can I ...
3
votes
0answers
36 views

SIGINT is not cleaned up in “${FUNCNAME[@]}”

Take the following script, interrupted by keyboard input ^C as shown: $ function a() { echo "Performing"; sleep 10; echo "Performed"; } $ a Performing ^C $ echo "${FUNCNAME[@]}" a source If we ...
0
votes
1answer
56 views

ctrl-c unsets echo on terminal [closed]

On different Linux distributions I experienced that pressing ctrl-c to stop a program (like 'cmp') or completion causes the terminal (usually xterm or gnome-terminal) to not echo the input any more. ...
5
votes
1answer
32 views

Should a service cancel and terminate incomplete work on SIGTERM?

Assuming that service does not leave things in "dangerous" or inconsistent state (though failures to carry tasks will be observed), should it close files, connections and any other work?
1
vote
3answers
64 views

Is there a Linux utility to halt all user processes, including a VM?

I know of the killall5, system V kill command. Is there something similar where I can send a SIGSTOP to all user processes, a Host OS and guest OS included? Possibly killall -SIGSTOP??
0
votes
0answers
27 views

AH00493: SIGUSR1 received. Doing graceful restart

My Apache is restarting a few times a week. I use cPanel and I have "piped logging" enabled (which should prevent restarts). However, how can I know what is sending SIGUSR1 signals to Apache at ...
2
votes
1answer
31 views

Clarification for Bash documentation on disown builtin option -h

According to the documentation: To prevent the shell from sending the SIGHUP signal to a particular job, it should be removed from the jobs table with the disown builtin or marked to not ...
2
votes
1answer
37 views

Trap ctrl c not working as expected

I have a code that looks like this: { trap cleanup SIGHUP SIGINT SIGTERM function executed() { if [ ${1} -ne 0 ] then echo "Failed!" cleanup ...
6
votes
2answers
140 views

Why does Bash ignore SIGINT if its currently running child handles it?

The following Bash loop stops if I interrupt it with ^C: (while true; do sleep 5; done) The following, however, does not: (while true; do aplay test.wav; done) The difference, from what I can ...
3
votes
1answer
84 views

Run one command after another in zsh when Ctrl-C is pressed

I have recently moved to zsh from bash (on OSX). I have an bash alias I have used to run one program then another (even if previous program exits with error) on bash. I can't work out how to ...
0
votes
0answers
26 views

How is a key sequence processed in a terminal? [duplicate]

My question comes from re-reading Gilles' excellent reply, and my recent comment on it. In a terminal (physical one, or virtual one such as Gnome terminal), when a key sequence is typed, is the ...
2
votes
1answer
36 views

Why is SIGHUP ignored by daemon(3) only in FreeBSD?

As part of the systemd tmux daemon() discussion on reddit, I've noticed that it's only the FreeBSD version of daemon() libc library call that ignores SIGHUP sigaction(2), but not OpenBSD or glibc/misc/...
4
votes
0answers
35 views

Linux application development and signal handling

Currently I am having problems with my users complaining about the termination of my application. Under some (seemingly arbitrary) conditions and desktop environments the app is not terminated and ...
11
votes
1answer
566 views

Is there any way to tell if a shell script was killed with signal 9

I have a bash script (called from a java program) that keeps getting killed. I always catch the signal 15 with trap but then some other signal comes along that I suspect is signal 9 but am in ...
1
vote
3answers
87 views

Why did my trap not trigger?

Given a script that echo's upon receiving a SIGSTOP or SIGHUP signal: $cat test.sh function clean_up { echo "cleaning up!" } echo 'starting!' trap clean_up SIGSTOP SIGHUP sleep 100 I ran it ...
2
votes
3answers
133 views

Why commenting out trap function allows control-c to work?

After standing up rhel VM and I was tailing a log file (tail -f xyz.log) however I realized that control-c didn't work to exit out of it. I tried control-z which did but that left background job so ...
0
votes
0answers
42 views

Fixing Signal 13 Error on find

I have a situation where I'm trying to install softwares into my system. I'm using a fakeroot approach to install them in a separate directory where I'm listing all the files, directories and links ...
0
votes
1answer
50 views

send signal to command pipe tears down whole pipe

I have a simple example of two processes the first is a simple loop which does some processing #!/bin/bash function signalHandler() { echo "sig: $1 received ==> exit" for i in {1..5}; do ...
0
votes
0answers
20 views

What is the difference between the SIGHUP generated by typing “exit” in the SSH shell terminal vs clicking the “X” button in the PuTTY window?

Referring to this question, I am trying to use nohup <command> <arg> & to continue to run a command in the background after I logout from the SSH shell terminal. However, the ...
3
votes
1answer
595 views

Where can I find detailed documentation on Linux signals?

When we do kill -l we get a list of all the signals that are supported, but is there any man page that describes each signal in detail?
0
votes
2answers
45 views

What are signal traps?

Signals are the way of communication between process but I have some questions What are signal traps? How the traps are related to signals in operating system?
3
votes
2answers
55 views

Bash script is not terminated with Ctrl+C

My script cannot be terminated with Ctrl+C key. It is an error. Please explain how to modify my script to make it terminable by Ctrl+C. #!/bin/bash while true; do paplay /usr/share/sounds/phone....
2
votes
0answers
21 views

Arbitrarily Start and Stop Process [duplicate]

This isn't a question about 'SIGSTP' and 'SIGSTOP'; I'm wondering if it's possible to save the state of a program in such a way that it can be stopped, saved to disk, and continued once the computer ...
1
vote
1answer
44 views

When a Linux (Ubuntu) system shuts down, which processes get sent a SIGTERM?

If I start an ongoing background process A which starts a child process B, and I ask the OS to shut down, which processes get sent a SIGTERM? Is it both A and B or is it just A (assuming that A should ...
3
votes
2answers
103 views

Relations between control characters, signals and terminal

What are the relations between control characters and signals? Or are they unrelated? Are control characters received by a terminal? After a terminal receives a control character, is the terminal ...
6
votes
1answer
142 views

Make bash exit != 0 when called by AWK and interrupted with ^C

I'm having an issue with the following piece of (G)AWK script: do { ... } while (system("sleep 10")) My intention is to break the loop when the user presses ^C during the sleep, but it's not ...
0
votes
1answer
130 views

How does one establish SIGRTMIN at run-time?

Reading up on signal(7) I can see that now: two, but once: three; signal numbers past 31 are reserved for use by the Real-time signal system and should not be used: Real-time Signals Linux ...
1
vote
1answer
27 views

Does a disowned process receive signals other than SIGHUP?

Is it correct that a shell can send signals only to its jobs, but can't send signals to processes which are not its jobs? disown moves a job out of the job list of a shell. Does that mean a disowned ...
4
votes
1answer
114 views

bash does not exit on abnormal exit of child process due to signal

I try really hard to understand what I am doing wrong and why? I have a launch.sh script which launches process.sh. launch.sh #!/bin/bash while true; do ./process.sh done process.sh #!/bin/...
1
vote
0answers
23 views

killing subprocesses and traps

I have the following two scripts which simulate some work: start.sh simply launches 2 (mpi) processes with script mpiproc.sh. start.sh #!/bin/bash function trap_with_arg() { func="$1" ; shift ...
3
votes
1answer
35 views

Is it possible to send an xpdf process a signal that causes it to reload the file being displayed?

On page change, redraw, or Reload command, xpdf will reload the file it is currently displaying. Is it possible to cause xpdf to reload the file by sending a signal? Which signal? (I am basically ...
0
votes
2answers
77 views

Detect power loss

Is it possible to detect loss of power on a laptop/desktop without an UPS? Obviously a computer without an UPS will shutdown at least almost immediately after being unplugged/having its battery ...
31
votes
4answers
2k views

What happens when a non-root user sends signals to root user's process?

I'm wondering about the security of UNIX signals. SIGKILL will kill the process. So, what happens when a non root user's process sends a signal to a root user's process? Does the process still ...
1
vote
1answer
86 views

SIGINT handling differences between bash 3 and 4

I have a script which works great in bash 4.3, but gives me unexpected behavior with bash 3.2. Here's a simplified version: set -o errexit -o pipefail task() { local name=${1} local duration=...
226
votes
4answers
21k views

How does a Segmentation Fault work under-the-hood?

I can't seem to find any information on this aside from "the CPU's MMU sends a signal" and "the kernel directs it to the offending program, terminating it". I assumed that it probably sends the ...
4
votes
2answers
341 views

What happends when sending SIGKILL to a Zombie Process in Linux?

In Linux, when a child process terminates and it's parent has not yet waited on it, it becomes a zombie process. The child's exit code is stored in the pid descriptor. If a SIGKILL is sent to the ...
5
votes
1answer
73 views

Ctrl+c and Ctrl+z to interrupt/suspend jobs

To kill a hanging job, I use Ctrl+c, to send an interrupt signal to the hanging job. Sometimes this wouldn't stop the job, at least not immediately. I can then use Ctrl+z to suspend the job and then ...
3
votes
1answer
128 views

sigint not being propagated to background child process

I need to send SIGINT to terminate a process gracefully but I can't. This is a sample, because the environment in which the execution occurs is 'unknown' (a bash script in travis.com) I managed to ...
14
votes
3answers
1k views

In `dmesg | head`, (how) is dmesg being killed after 10 lines of output? [duplicate]

If I run these commands: dmesg | head -n 10 I presume the OS sends back some kind of signal to dmesg once head has read 10 lines. How does this work? What does head tell the kernel? This is ...
3
votes
1answer
69 views

`EINTR`: is there a rationale behind it?

Small talk as background EINTR is the error which so-called interruptible system calls may return. If a signal occurs while a system call is running, that signal is not ignored and a signal handler ...
1
vote
1answer
177 views

use exec -a to name process but run it in the background immune to CTRL-C

I would like to start a background process from bash script, but at the same time give it another name and also make it immune to CTRL-C. I tried the following: exec -a NiceName java -cp ....long ...
1
vote
2answers
1k views

How can I wake a process from sleep status via signal or /proc?

Many years ago I had an issue with Linux where processes would randomly go to sleep. Back then, I knew a trick with the /proc filesystem to trigger a wakeup of the process. I vaguely remember being ...
3
votes
1answer
180 views

Difference between less violent kill signal -HUP (1) -INT (2) and -TERM (15)

Apart from the most violent kill -9 (SIGKILL), I don't quite understand the difference between the 3 other common signals (here) -HUP (1), -INT (2), and -TERM (15). In which scenarios would one work ...
3
votes
4answers
52 views

Is there a variant of watch that only refreshes upon receiving a signal?

I have a window that runs a somewhat expensive watch git log ... incantation — expensive enough that it actually looks more like watch -n30 timeout 10 git log ... so that it doesn't excessively ...
1
vote
1answer
32 views

Does SIGHUP get triggered upon broken telnet/SSH connection?

I'm trying to write a mail program which might contain data that a user wouldn't want to lose upon a broken SSH/telnet connection. Would SIGHUP be sent to the process? After all, it's the "hangup" ...
10
votes
1answer
173 views

Why does a while loop stop after being suspended?

Why is it that using bash and suspending a while loop, the loop stops after being resumed? Short example below. $ while true; do echo .; sleep 1; done . . ^Z [1]+ Stopped sleep 1 $ ...
2
votes
1answer
103 views

Xvfb not sending SIGUSR1, breaking xvfb-run

I've been working a knotty problem trying to run headless tests using the xvfb-run script provided with Xvfb. It works on my own Ubuntu images running in VirtualBox, but on the Ubuntu 15.04 AMI that ...
2
votes
1answer
161 views

Bash shell launched by forkpty() spawns child processes that ignore SIGINT. Why and how do I ensure SIGINT is not ignored?

I have a C program that uses forkpty to execute a bash shell. I'm finding that the programs launched by this shell are launched with SIGINT ignored, so when I send a Ctrl-C to the shell they never ...
1
vote
1answer
84 views

Signal execution details

I am reading some Linux documentation about 'signals' and I still have these questions making noise in my mind: 1) A 'signal' handler execution is done when the 'target' process receives its ...