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

0
votes
2answers
61 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 ...
3
votes
2answers
1k views

Suppress “Alarm clock: 14” from ping

I've made a simple script for rebooting my router and afterwards showing a progress bar until my computer has an internet connection again. When running the script I get the following output: The ...
6
votes
2answers
103 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
57 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
28 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
31 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
556 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
75 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
117 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
37 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 ...
6
votes
4answers
2k views

Can signal be ignored (lost)?

I have an application which is communicating with workers via signals (particullary SIGUSR1/SIGUSR2/SIGSTOP). Can I trust that whatever happens every signal will be delivered and processed by handler?...
0
votes
1answer
44 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
16 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 ...
7
votes
2answers
783 views

SIGINFO on GNU Linux (Arch Linux) missing

I am developing an application and I would like it to print some runtime stats to the console on demand. kill and signals came to my mind immediately. Reading through Unix signals on Wiki, SIGINFO ...
3
votes
1answer
592 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?
6
votes
2answers
3k views

What are pending signals?

When looking at the limits of a running process, I see Max pending signals 15725 What is this? How can I determine a sensible value for a busy service? Generally, I can't seem to find a ...
43
votes
6answers
9k views

Timing out in a shell script

I have a shell script that's reading from standard input. In rare circumstances, there will be no one ready to provide input, and the script must time out. In case of timeout, the script must execute ...
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....
6
votes
1answer
137 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 ...
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
40 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
100 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 ...
0
votes
1answer
79 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
26 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 ...
27
votes
10answers
69k views

How to stop the loop bash script in terminal?

For example, #!/bin/bash while : do sl done How to terminate this bash script?
3
votes
1answer
33 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 ...
4
votes
1answer
97 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
22 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 ...
21
votes
7answers
26k views

Terminating an infinite loop

I have a command that I want to have run again automatically each time it terminates, so I ran something like this: while [ 1 ]; do COMMAND; done; but if I can't stop the loop with Ctrl-c as that ...
14
votes
7answers
4k views

Unable to stop a bash script with Ctrl+C

I wrote a simple bash script with a loop for printing the date and ping to a remote machine: #!/bin/bash while true; do # *** DATE: Thu Sep 17 10:17:50 CEST 2015 *** echo -e "\n*** DATE:"...
17
votes
5answers
12k views

How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?

I'm trying to set up a shell script so that it runs background processes, and when I Ctrlc the shell script, it kills the children, then exits. The best that I've managed to come up with is this. It ...
225
votes
4answers
20k 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 ...
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
76 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=...
5
votes
1answer
1k views

A script's background process is still alive after closing the terminal

This is more of a process management/signal handling question than a Bash question. It just uses Bash to explain the issue. I'm running a Bash script in which I run a background process. This is the ...
4
votes
2answers
283 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 ...
6
votes
2answers
333 views

In zsh, how can I more quickly disown the foreground process?

My method for disowning the foreground process takes too much effort. Suppose I have a process in zsh's foreground. I want to disown it, so I can close the shell without the process being sent a ...
5
votes
1answer
67 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
101 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 ...
9
votes
1answer
14k views

when does the system send a SIGTERM to a process?

My server program received a SIGTERM and stopped (with exit code 0). I am surprised by this, as I am pretty sure that there was plenty of memory for it. Under what conditions does linux (busybox) send ...
3
votes
1answer
66 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
143 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
148 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 ...
50
votes
5answers
8k views

How can I check what signals a process is listening to?

How can I verify whether a running process will catch a signal, or ignore it, or block it? Ideally I'd like to see a list of signals, or at least not have to actually send the signal to check.
3
votes
4answers
51 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
29 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" ...