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

1
vote
1answer
27 views

Start a background process from a script and manage it when the script ends

I'd like to run and configure a process similarly to a daemon from a script. My shell is zsh emulated under Cygwin and the daemon is SFK, a basic FTP server. For what matters here, the script ...
1
vote
2answers
35 views

Control which process gets cancelled by Ctrl+C

I have a live CD that boots into Linux and runs a small Bash script. The script searches for and runs a second program (which is usually a compiled C++ binary). You're supposed to be able to abort ...
1
vote
1answer
5 views

What is the meaning of every column when executing psig command?

I try to use psig command to track signal dispositions of a process on Solaris: bash-3.2# psig 3109 3109: bash HUP caught termsig_sighandler 0 ...
1
vote
1answer
19 views

What does the command pkill -USR1 -n -x dd mean exactly?

I am using dd to do a network transfer of a disk image to an sd card on my BeagleBone. Using pkill -USR1 -n -x dd in an ssh connection to this BeagleBone gives me a status update of the transfer ...
2
votes
0answers
32 views

Kill a whole process tree regardless different GIDs

I am having issues with process control using the signals available to the process abstraction. In the example below you can see there is a perl script which is the parent of the whole tree with a ...
3
votes
1answer
31 views

Terminating SSH called from a script (SIGPIPE handling?)

so I was wondering why there are some hanging SSH connection left from some of my automated scripts and I came to a weird issue - SSH, if used without PTY, doesn't terminate when the output pipe gets ...
1
vote
1answer
51 views

How to restore the default signal processing behavior on Solaris?

I have found the signal processing behavior on my Solaris 10 is changed. For example, when I Ctrl+C, the program can't exit. Use psig to check the signal processing behavior: HUP default INT ...
2
votes
1answer
59 views

Prevent SIGINT from interrupting function call and child process(es) within

Consider the following script: #!/bin/bash set -o pipefail set -o history trapper() { func="$1" ; shift for sig ; do trap "$func $sig" "$sig" done } err_handler () { case $2 in ...
17
votes
2answers
940 views

Why does `kill -l` not list signal numbers of 32 and 33?

Executing kill -l on linux gives: 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV ...
1
vote
1answer
45 views

Send specific signal number with specific key

I want to set a specific key like F12 to send me a specific signal number that out of linux signals range that I can handle this signal with trap command. How can I do that? NOTE: I'm working with ...
4
votes
1answer
83 views

How to catch a signal in command line?

I asked this question. SIGPIPE signal is generated to stop the execution of the command as told in the answer. But how do I capture this signal and gracefully terminate the command? The command exits ...
1
vote
1answer
29 views

PID of process causing error

I have this script: #!/bin/bash # -> dump.$pid ulimit -c unlimited # trap ERR set -o errexit # also trap error in the middle of a pipe (1) # otherwise it will only trap the error on (2) set -o ...
2
votes
0answers
19 views

unbuffer/expect swallows the rcode when its child is signaled

unbuffer is able to pass along the return code of a process under normal circumstance, but if the process you are unbuffering is killed, for instance with a segfault, I see $? as 0 while I expect 139. ...
0
votes
0answers
23 views

Show signals received by processes [duplicate]

Is there a command or file that stores what signals each process receives? I know if I open one from a terminal and kill -9 PID it'll tell me, but what about something like firefox that is opened ...
1
vote
2answers
44 views

What happens to the signals requested recursively?

People often hit Ctrl + c or Ctrl + z to cancel or abandon the job if the process gets sluggish, in this case which of these signals get processed, the first one or the last one? is each signal ...
3
votes
2answers
59 views

Why is my trap not printing any log message?

What I'm doing is, trap 'rm -f /path/of/file/fileName.running; echo "TRAPPED & READY";' 1 2 9 15 >> trap.log I didn't get anything in log & the file which should have been deleted ...
8
votes
4answers
2k views

Send SIGINT to child process of shell, simulating CTRL+C (Linux)

Given a shell process (e.g. sh) and it's child process (e.g. cat), how to simulate the behavior of CTRL+C using the shell's process ID? This is what I've tried: Running sh and then cat: ...
2
votes
1answer
20 views

Multiple processes reporting signals received

If I run multiple programs with program & in one terminal, and then from another one start sending SIGKILL SIGINT or any other signal, will the terminal running all the processes tell me what ...
1
vote
1answer
41 views

Can Linux programs be sent a SIGXXX command they can respond to in the UI?

I am trying out the timeout command and would like to know if there is a kill signal that a GUI program, whether a graphics desktop or a terminal program will treat as the user terminating the program ...
2
votes
1answer
216 views

Forward SIGTERM to child in Bash

I have a Bash script, which looks similar to this: #!/bin/bash echo "Doing some initial work...."; /bin/start/main/server --nodaemon Now if the bash shell running the script receives a SIGTERM ...
1
vote
0answers
51 views

Trap not trapping SIGTSTP

I have a script that keeps displaying the login prompt: #!/bin/bash trap '' 2 20 while true; do login done This is part of a bigger project so please don't tell me to just use the system login ...
0
votes
2answers
44 views

Idiomatic way to kill -9 only if “graceful” way doesn't work?

Is there a common way or existing utility to do the following? kill a process Give it a few seconds to shut down gracefully kill -9 it if it hasn't stopped
4
votes
2answers
93 views

How to programatically detect when a device raises an interrupt?

How to programatically detect when a device raises an interrupt? This can be when a device is connected or disconnected. And also this case: for example: when a finger is held over a fingerprint ...
5
votes
1answer
47 views

Ctrl-C is ignored by pppd when put in a shell script

I'm trying to connect to GPRS network through a serial port connected GSM modem. When I call /usr/sbin/pppd call <peer_name> from the command line, it correctly receives and handles Ctrl+C from ...
1
vote
1answer
27 views

How do I obtain the kill signal / message / reason within a script?

I am using the following trap: trap OnExit EXIT And in my OnExit function I would like to capture all the info I can on what happened so I can write it to a log file. Id like to know who, why, how, ...
2
votes
1answer
46 views

What signal does X send to its clients when it receives SIGINT?

If I terminate the Xorg server with a SIGINT signal (eg. when I press Ctrl+C), what signal does it send to its clients?
2
votes
1answer
63 views

Does this dispatcher produce zombie process?

I have such a dispatcher shell script. while read line do java TestProg $line & done < $tasklist On the zombie process Wikipedia page, it says if a parent fails to call wait, the ...
3
votes
1answer
94 views

SIGKILLing after a grace period

I've seen a lot of process managers that try to do this. It was my understanding that you should only use SIGTERM to kill a process. The process could take an unknown amount of time to clean up after ...
0
votes
0answers
34 views

Execute snippet of code when key is pressed [duplicate]

I want to create a process in Linux which waits for some particular keys to be pressed and executes a snippet of code and goes back to sleep. How can I achieve this? Initially a process will be in ...
2
votes
1answer
953 views

ctrl c vs. ctrl z with foreground job

Ctrl+Z stops the job whereas Ctrl+C kills the job. Why is that? Wouldn't the other way make more sense? z@z-lap:~$ sleep 100& [1] 4458 z@z-lap:~$ sleep 200& [2] 4459 z@z-lap:~$ jobs [1]- ...
7
votes
1answer
265 views

stderr over ssh -t

This sends output to STDERR, but does not propagate Ctrl+C (i.e. Ctrl+C will kill ssh but not the remote sleep): $ ssh localhost 'sleep 100;echo foo ">&2"' This propagates Ctrl+C (i.e. ...
12
votes
2answers
824 views

How to terminate remotely called “tail -f” when connection is closed?

I just noticed that if I execute ssh user@remote_host tail -f /some/file , then tail -f /some/file keeps running on the remote_host even if ssh connection is closed! So, after several connects and ...
0
votes
0answers
185 views

Archive (Compress) giant folder in Linux using command line without termination

Well, I'm just trying to compress a whole directory (infact giant!) under Linux using a terminal. The entire folder size is about 7 GB. I've used below command to create the archive. tar -zcvf ...
2
votes
3answers
143 views

CTRL C behavior in hierarchy of shells

First of all sorry about terminology errors, I'd try to be clear. I open a shell (like sbt or node debug from my bash). Then inside this shell, I open another one (using scala or node repl ...
3
votes
5answers
960 views

Getting pid of bash script from itself

I have a bash script with doing lot of things called script.sh: #!/bin/bash #It #Is #Doing #Things Is there a way that I be able to get the proccess of script and then kill it after 5 minutes? ...
0
votes
2answers
321 views

Disable the display of “terminated xxx” info of bash

For example, when I kill a background process, then bash weil display terminated xxx, How to disable this info? $ ping g.cn >/dev/null & [1] 25123 $ pkill ping [1] + 25123 terminated ping ...
2
votes
1answer
77 views

calling sigprocmask from bash

I have a process that spawn a bash command with system() while the signal mask has all the signals blocked. This cannot be fixed easily. The bash command eventually execs into a process. The all ...
2
votes
2answers
36 views

Does time window still exist when the signal is not blocked

Many books say that a time window exists between the generation and delivery of the signal when the signal is not blocked. So I wonder whether the time window still exists when the signal is not ...
2
votes
2answers
163 views

Bash script to signal a concurrently running instance (same script) about a condition and increment counter

Background Here's what I want to achieve. I have a (potentially) long-running process. Now I have locking in place just fine and all is generally in order. However, since this is a scheduled job, ...
1
vote
1answer
183 views

service killed at ssh hangup [duplicate]

If I use ssh to run some command in background, that command gets killed as soon an ssh hangs up: ssh localhost -t "bash -c '(for i in 1 2 3 4 5; do sleep \$i;done)&'"; ps x|grep sleep This ...
5
votes
2answers
423 views

Processes do not respond to my signals

I have a strange behavior on my system. When I invoke a command in the shell (bash version 4.2.45(1)-release), say top or cat, the running program (the process) does not respond to Ctrl+C. I even ...
35
votes
6answers
4k views

Does pressing ctrl-c several times make the running program close more quickly?

I often start to read a huge file and then want to quit after a while, but there is a lag from pressing Ctrl+C to the program stops. Is there a chance of shortening the lag by pressing the Ctrl+C key ...
4
votes
4answers
3k views

Ctrl-C with two simultaneous commands in bash

I want to run two commands simultaneously in bash on a Linux machine. Therefore in my ./execute.sh bash script I put: command 1 & command 2 echo "done" However when I want to stop the bash ...
0
votes
2answers
284 views

What does this logrotate nginx config do?

In my /etc/logrotate.d/nginx I saw, /var/log/nginx/*.log { daily missingok rotate 52 compress delaycompress notifempty create 640 nginx adm ...
1
vote
2answers
811 views

Ctrl-C handling in SSH session

When I start an SSH session that executes a long-running command, what happens with Ctrl+C (SIGINT) handling? I can see that the SSH session is closed, but I am not sure who gets the SIGINT first: is ...
2
votes
2answers
313 views

Pipe command to tail: when is the first command aborted?

In this example: $ for i in {1..3}; do sleep 1; echo $i; done | head -n 2 why is the first command (for loop) killed only just before the 3 is displayed ? I expected it to be killed right after ...
12
votes
3answers
5k views

Default exit code when process is terminated?

When a process is killed with a handle-able signal like SIGINT or SIGTERM but it does not handle the signal, what will be the exit code of the process? What about for unhandle-able signals like ...
2
votes
1answer
342 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 ...
5
votes
1answer
93 views

Do not set $? to non-zero on Control+C

My $PS1 in Zsh includes this expression: %(?. %?.) It means «if exit code of previous command ($?) is true, show $?, else show nothing». This is generally useful, but one thing annoys me: shells set ...
2
votes
1answer
1k views

child process does not inherit the pending signals from the parent after a fork system call, why?

Could anybody please tell me the reason to why pending signals are not inherited by the child process? On the other hand, the child process inherits the signal handlers and signal mask from the ...