A signal is a message which can be sent to a running process. Signals can be initiated by programs, users, or administrators.
6
votes
2answers
118 views
Decode Flags for Kill Command
I am new to Shell Scripting.
I saw this Command on a Book for Linux shell Scripting
$ kill -HUP 1234 >killout.txt 2>killerr.txt
I know what the command does, but i am not able to understand ...
4
votes
3answers
123 views
What process is running before I even get a prompt?
When I log in to a specific server I see the following:
Note that I get get Last login: ... information but no prompt. I hit Ctrl+C and only then do I get my prompt, thus proving that my username ...
3
votes
1answer
77 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 ...
2
votes
2answers
69 views
End process from another SSH window
I forgot to use screen and I have a task that has been running for quite some time, and I do not want to lose the saved data. Basically Ctrlc will end the task and save the data if I am on the same ...
3
votes
1answer
109 views
sigaction(7): semantics of siginfo_t's si_code member
I've got a long-running program (becomes a daemon with daemon(3) call) that exits on Signal 11 (Segmentation Violation) every so often. I can't tell why. So, I wrote a SIGSEGV handler, set using the ...
2
votes
1answer
56 views
Why is `kill -s INT <zsh PID>` behaving differently from `Ctrl-C`?
Starting with:
% donothing () { echo $$; sleep 1000000 }
% donothing
47139
If at this point I hit Ctrl-C at the same terminal that is controlling the shell, then the function donothing does indeed ...
1
vote
1answer
122 views
System sending SIGTERM and SIGKILL during normal work
I have a program (C++) that works with TCP sockets in multithreaded manner. The multithreading is intensive, about 100 threads (POSIX threads).
Sometimes, not quite sure when, the program gets ...
1
vote
2answers
60 views
Mapping intr to del key
I am in the process of migrating a legacy 4GL application from SCO OpenServer 5.0.7 to CentOS (Red Hat) Linux 5.9.
There are a number of screens that prompt the user to press "DEL to ABORT" but is ...
6
votes
3answers
250 views
What's the difference between Ctrl-Z and kill -STOP?
When I run a command (make on a large project) from the shell, I can type Ctrl-Z to stop the process and return to the shell. Subsequently, I can run fg to continue the process.
I'm trying to write a ...
2
votes
1answer
57 views
Chain commands with Control + C interrupt
I am trying to execute a program which loops indefinitely, and so must be forcibly interrupted. After executing the program, I want to delete it. I can do it in several steps:
./MyProg
Control + C
...
16
votes
1answer
492 views
How does systemd survive a kill -9?
Between the recent "Why does 'kill -9 0' end my console session" and "How to get a kernel panic" questions, I got a bur under my saddle and tried kill -9 1 on a mostly up-to-date Arch linux laptop. I ...
3
votes
1answer
144 views
What is the difference between exiting a process via Ctrl+C vs issuing a kill -9 command?
I know I can kill any process with kill -9 command . But sometimes i see that even if I have terminated a program with CTRL+C , the process doesn't get killed . So I want to know the difference ...
1
vote
3answers
203 views
What happens to suspended jobs in unix?
We can issue CTRL+Z to suspend any jobs in Unix and then later on bring them back to life using fg or bg. I want to understand what happens to those jobs that are suspended like this ? Are they ...
3
votes
2answers
261 views
Why does Subversion give a broken pipe error when piped into head?
If I do a
svn log | head
after the tenth line of output I get an error message:
svn: Write error: Broken pipe
What's going on here? I haven't seen any other command do this when used with head. ...
6
votes
1answer
141 views
What should interactive shells do in orphaned process groups?
(Re-posting in unix per the suggestion in http://stackoverflow.com/questions/13718394/what-should-interactive-shells-do-in-orphaned-process-groups)
The short question is, what should a shell do if it ...
5
votes
1answer
236 views
`kill -s TERM` works, `kill -s ABRT` gets “Operation not permitted”
There is a process that I own whose documentation claims I can send SIGABRT to in order to get some debugging information. However, when I try to send SIGABRT, I get back "Operation not permitted".
I ...
5
votes
1answer
345 views
“trap … INT TERM EXIT” really necessary?
Many examples for trap use trap ... INT TERM EXIT for cleanup tasks. But is it really necessary to list all the three sigspecs?
The manual says:
If a SIGNAL_SPEC is EXIT (0) ARG is executed on ...
2
votes
2answers
201 views
Why can't I kill a timeout called from a Bash script with a keystroke?
[Edit: This looks similar to some other questions asking how to kill all spawned processes – the answers all seem to be to use pkill. So the core of my question may be: Is there a way to propagate ...
1
vote
0answers
135 views
Why does this pipeline get SIGTTIN?
When I run the command for i in *.log; do cat "$i" | sort; done | more, the pipeline gets a SIGTTIN signal and is stopped.
bash$ for i in *.log; do cat "$i" | sort; done | more
### (one screenful of ...
5
votes
3answers
1k 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 ...
11
votes
3answers
411 views
How Can Terminal Emulators Kill Their Children After Recieving a SIGKILL?
From what I understand, SIGKILL cannot be caught. This would imply that a process does not have time to kill it's children before the OS destroys it. This can be demonstrated with a shell script.
...
3
votes
2answers
225 views
Why there are only two user defined signals?
In the list of signals defined in a linux system, there are two signals stated as User Defined signals (SIGUSR1 and SIGUSR2). Other signals will be raised or caught in specific situations, but SIGUSRs ...
3
votes
3answers
2k views
How to stop the loop bash script in terminal?
For example,
#!/bin/bash
while :
do
sl
done
How to terminate this bash script?
2
votes
1answer
126 views
Control character STTY issue
I am changing control character (e.g- ^C) using
stty intr ^_
under root privileges. It changes successfully.
But when I am closing terminal and opening terminal again to check whether same ...
0
votes
0answers
102 views
my code not able to display the catched signal result [closed]
my code here is intended to display the received signal that's it but its not working when i try to send the signal
kill -SIGUSR1 pid
or
kill -10 pid
or any other signals according to my ...
2
votes
2answers
398 views
Why would Ctrl-C behave differently than kill -2
I have a program which is supposed to handle SIGINT and gracefully shut down. When I run this program from a terminal without backgrounding it I can shut it down just fine using Ctrl-C. Inspecting the ...
2
votes
0answers
78 views
Busybox exits instantly printing 'SIGUSR1'
I was tinkering with my router these days. It runs on MIPS core and the OS is based on Linux. But the builtin busybox is very limited. I managed to export a binary of busybox compiled for MIPS through ...
3
votes
1answer
146 views
How are signals implemented in Linux?
When one process sends a signal to another process, does receiving process wait until it is rescheduled to run? So if every 1 ms we choose one process to run, does that mean the latency from ...
5
votes
1answer
175 views
SSH session pauses mid datastream; resumes with a keypress
I've had this problem occur at random, intermittently, across boxes at multiple companies, multiple distros, and multiple kernel revs. I think that I'm just cursed.
What happens is that I'll have a ...
10
votes
3answers
2k views
Telnet send Ctrl-C
I use telnet to connect to a terminal server, which proxies the traffic to a RS-232 port.
Unfortunately when using some of the devices it is not possible to send the ctrl-C character (0x03). Instead ...
5
votes
3answers
1k views
How to make `xargs` ignore child's exit and keep processing further
I sometimes run long xargs jobs overnight and it is really annoying to discover in the morning that xargs died somewhere in the middle, for example because of a segmentation fault in one single ...
3
votes
4answers
1k 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 ...
1
vote
1answer
370 views
difference between signalfd and sigwaitinfo?
I went through examples and man page but couldn't figure out difference between signalfd and sigwaitinfo
Apart from syntax both are doing same thing i.e. waiting for signal storing it details into ...
6
votes
2answers
956 views
Get ssh to forward signals
I want to be able to send signals (SIGINT is the most important) through ssh.
This command:
ssh server "sleep 1000;echo f" > foo
will start sleep on server and after 1000 seconds it will put ...
2
votes
1answer
2k views
Why does SIGUSR1 cause process to be terminated?
I was surprised with this comment in other question:
Sending dd the USR1 signal too soon after it has started (i.e. in a bash script, the line after you started it) will in fact terminate it
Can ...
4
votes
1answer
825 views
Why is my C++ program killed by OS
I've compiled small C++ application for school project on my virtual ubuntu 11.04. However when I attempt to run it over some larger data set after ~20 sec the program is killed by OS.
Killed ...
2
votes
3answers
483 views
Killing other user processes
There are certain user environments in which we have to login during certain performance testing and and kill all the process running in that environment.
The environment names are like rswrk01, … up ...
3
votes
1answer
389 views
Issue with WINCH signal - what am I overlooking?
I am having an issue with the WINCH signal in the following code which is from a tutorial located at developerWorks®:
#!/bin/bash
trap 'get_window_size' WINCH # trap when a user ...
19
votes
2answers
367 views
When you try to terminate a process for good, which option for “kill” should you use?
I am getting a lot of mixed messages from people, and was wondering if it there really is not much of a difference in what you use.
kill 'x'
killall 'x'
kill -9 'x'
These are some options I've been ...
2
votes
1answer
146 views
Why doesn't an orphan process receive signals?
I have two shell scripts: launch_job.sh and sub_job.sh.
If launch_job.sh uses the following method to run sub_job.sh:
nohup sub_job.sh &
sub_job.sh becomes an orphan, i.e. with PPID 1.
I ...
1
vote
1answer
605 views
Crash and exit code 721035
Where can I find what this exit code means?
I have process (A) that calls program (B) using clib system(). Sometimes program (B) returns with exit code 721035 and AIX kills process A. This is random ...
3
votes
2answers
1k views
How can I trap a program that returns 139 (segmentation fault) in bash?
I have a bash script that tests some programs and one of the program returns Segmentation fault so I tried to add a trap in the head of my script:
trap "echo 'segfault occured!'" SIGSEGV
That ...
3
votes
2answers
363 views
Wrapper program that sets signal handler
I would like to have a wrapper program that runs a given command and sets a signal handler so that it gets run when the command receives a specified signal.
The question is this:
Is there an ...
2
votes
1answer
337 views
What does “trace trap” mean when reported by zsh?
I am trying to run a set UID root program in UNIX using the zsh shell. But I keep getting this message
$ ./progExe
zsh: trace trap ./progExe
Can anyone please tell what does “zsh: trace trap” mean?
...
19
votes
2answers
1k views
why would typing Ctrl+c twice stop a running process in Linux?
There are Linux programs, for example vlc, that recommend typing ctrl+c twice to kill their execution from a terminal if the program didn't stop after the first one.
Why would typing ctrl+c twice ...
2
votes
4answers
2k views
Ctrl+C does not work in gnome-terminal
On my Linux host, Ctrl+C does not seem to work and I do not know how to proceed to make it work. I am using Ubuntu 10.04 with bash 4.1.5(1), and working in Gnome-terminal.
When I pressed Ctrl+C while ...
2
votes
1answer
1k views
What is signal 0 in a trap command?
I'm following this guide on how to set up passwordless SSH authentication with ssh-agent.
To start up ssh-agent the author recommends the following code in .bash_profile:
SSHAGENT=/usr/bin/ssh-agent
...
6
votes
2answers
676 views
Interruption of system calls when a signal is caught
From reading the man pages on the read() and write() calls it appears that these calls get interrupted by signals regardless of whether they have to block or not.
In particular, assume
a process ...
4
votes
2answers
3k views
How to signal the end of stdin input in bash
In Bash, I learned that the ending
signal can be changed by here
document. But by default how can I
signal the end of stdin input?
I happened to find that with cat and
chardet, their stdin inputs can ...
7
votes
1answer
601 views
confirmed exit using trap
I am trying to trap the Ctrl+C signal asking a confirmation from the user. The trapping part works fine. But once the signal gets trapped, it does not return to the normal execution. Instead, it quits ...

