Questions tagged [signals]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Background process is not being terminated by SIGINT when executed via ssh

I was experimenting with ssh, nohup, bg etc. I started a tail process in remote using $ ssh remotehost '{ nohup tail -f ut.log &> /dev/null < /dev/null &} && echo $!' It ...
Sourav Kannantha B's user avatar
0 votes
1 answer
49 views

Where does the signal that causes EINTR come from?

I Understand that EINTR is an error which so-called interruptible system calls may return. My question is where does the signal that causes EINTR come from? I faced this quite often when using fnctl ...
chewing gum's user avatar
1 vote
0 answers
15 views

Freebsd12: Process killed instead of swapping out

I run FreeBSD 12 through Vagrant on a VM with 350 MB RAM and 2 GB swap. If I run: perl -e '$a="x"x200_000_000;sleep 1000' & sleep 10 perl -e '$a="x"x200_000_000;sleep 1000' &...
Ole Tange's user avatar
  • 33.8k
0 votes
0 answers
36 views

Process not stopping even after receiving Ctrl-Z

I was learning about signal handlers. I wrote a simple python script to handle and print all signal it gets. Then I ran that script on a remote machine through ssh. Then when I send Ctrl C signal, the ...
Sourav Kannantha B's user avatar
0 votes
0 answers
46 views

Memory protection keys: Exception handler crashes if pkey0 is write-disabled

Background: in-process isolation based on memory protection domains in x86/linux using memory protection keys (MPK) and the protection key register PKRU. Setup: The program first executes ...
Robert Kueffner's user avatar
0 votes
2 answers
71 views

How can I make my looping shell script pause after a loop by sending something like ctrl-z and then be continuable?

I have a shell script that loops over files. Processing each file can take several hours (it is CPU/GPU-limited). Sometimes I want to pause the execution at the end of a loop, when a file is finished ...
d-b's user avatar
  • 1,713
0 votes
0 answers
27 views

Why does bash send SIGTERM to program after logout despite setting nohup and disown

I want to run a program which continues after logout from an ssh session. I've tried: nohup myProg > /tmp/logfile 2>&1 & disown %1 and systemd-run --scope --user myProg -p > /tmp/...
Danny's user avatar
  • 521
5 votes
3 answers
211 views

How to cleanup on suspense (ctrl-z) in a Bash script?

I have the following script: suspense_cleanup () { echo "Suspense clean up..." } int_cleanup () { echo "Int clean up..." exit 0 } trap 'suspense_cleanup' SIGTSTP trap '...
Sebastian Carlos's user avatar
5 votes
1 answer
502 views

Why does sending a trapped signal cause `read` to return in POSIX shell but not in Bash?

I was trying to write a shell script that idly waits for a signal in the background. Since the script doesn't take user input I thought of using read to block the script indefinitely while waiting. In ...
yvay's user avatar
  • 53
0 votes
2 answers
56 views

Is any desktop using SIGSTOP save CPU performance?

On GNU/Linux I can send the SIGSTOP signal with $ kill -STOP Then I can send SIGCONT to activate it again, That saves CPU performance from being used up like 11% from a minimised Firefox window "...
rich's user avatar
  • 1
0 votes
0 answers
24 views

Why does this script get to linger after having seemingly exited from Ctrl-C? [duplicate]

I have a script, script-A, which runs script-B. When run under the terminal, it terminates as expected from Ctrl-C, but when run via ssh it continues to silently run after Ctrl-C even though ssh ...
yong's user avatar
  • 351
1 vote
1 answer
92 views

^C SIGINT does not work in adb shell in Linux

I am working on an embedded Linux system, which uses kernel-5.10.24. It uses busybox as init, and has other utilities in rootfs, including adbd. I can run adb shell from PC to login to the embedded ...
wangt13's user avatar
  • 327
0 votes
3 answers
1k views

how to diagnose the originator of the signal 15 send to sshd

I recently met a issue that my sshd keep dead repeatly, I did the following check. from the /var/log/message, I could see the sshd keeped restarting Apr 23 12:05:39 host1 systemd: Stopping OpenSSH ...
wang larry's user avatar
0 votes
1 answer
168 views

How to track all signal in 'trap'?

Can I test keyboard shortcuts and some kill commands with a script and know which signal is caught by trap?
Gilles Quénot's user avatar
0 votes
0 answers
79 views

sigtimedwait sets errno to ETIMEDOUT with timeout=0

In a cpp multithreaded program, we're using a copy of Linux sigwait implementation at the end of our main function, after creating all threads and initializing our program: sigset_t mask; ...
binks's user avatar
  • 1
2 votes
0 answers
278 views

It's possible to force a graceful shutdown when you kill a QEMU process?

I'm working with a Ubuntu VM with QEMU, I understand that when the Host (Mac M1 in my case) makes a shutdown sends a SIGTERM to all processes, but when arrives the signal to QEMU the Ubuntu does ...
Javier Tacón's user avatar
1 vote
1 answer
509 views

Trapping SIGINT so that the process kills itself

So section 5 from here made sense to me and I wanted to implement it. I have this bash script #!/usr/bin/env bash cp aux.sh aux.sh.bak cleanup() { cp aux.sh.bak aux.sh rm -rf aux.sh.bak } ...
leo's user avatar
  • 113
0 votes
0 answers
85 views

It seems that the systemctl stop does not normally terminate my process

When I enter the systemctl stop command to exit the process and check the status with the systemctl status command, some of the items that need to be printed are not found. For example, if you check ...
monster-dev's user avatar
4 votes
1 answer
120 views

Inside less, is there an equivalent of ctrl-Z to recover the pager prompt?

I will occasionally use the pickaxe functionality of git to locate changes of interest. This can be quite slow, obviously (the same would apply to, say, hg grep), but more significantly it is bursty: ...
Pierre Lebeaupin's user avatar
1 vote
1 answer
693 views

Process not receiving SIGTERM in Docker container

I've got a simple Python process running in a Docker container: Dockerfile: FROM ubuntu:18.04 RUN apt -y update && apt -y install python3 COPY app.py /app/ WORKDIR /app ENTRYPOINT ["./app....
Daniel Walker's user avatar
0 votes
1 answer
257 views

Make systemd treat unexpected exit as failure

I'm wrapping a 3rd party executable in a systemd service unit to manage it. I can't alter the behavior of this program and I don't really trust its exit codes. I would like to treat any exit that ...
davolfman's user avatar
  • 509
1 vote
1 answer
135 views

Send and trap SIGTTIN SIGTTOU in foreground process?

From the description of signals (reference), it seems like SIGTTIN and SIGTTOU are sent to a process only if it is in background. Pressing Ctrl-s does stop printing in terminal, if such flow control ...
codepoet's user avatar
  • 566
42 votes
3 answers
6k views

How is a signal "delivered" in Linux?

I am confused by the terminology used to describe Linux signal delivery. Most texts say things like "the signal is delivered to the process" or "the signal is delivered to the thread&...
Albert's user avatar
  • 511
2 votes
1 answer
193 views

How to stop program of non-interactive SSH call without pseudo-terminal

Let's say I start a program with a non-interactive SSH call (without pseudo-terminal) and exit the session via CTRLC: $ ssh user@server -- sleep 123 ^C This way, the program, in this case sleep 123 ...
finefoot's user avatar
  • 2,990
0 votes
1 answer
71 views

Trapping shell script doesn't work when used over SSH [duplicate]

I am working on client and want to run a script on server which includes a trap. The following minimal example works fine if I connect to server and run it in an interactive SSH session: user@client:~$...
finefoot's user avatar
  • 2,990
0 votes
1 answer
101 views

Why does the `man` command not handle SIGINT or SIGQUIT?

When using man, I noticed that you need to use the q key to exit instead of using CTRL + C (SIGINT) or CTRL + D (SIGQUIT) signals. Is there any reason for this? I couldn't find anything in the man ...
LeoDog896's user avatar
  • 147
0 votes
0 answers
34 views

Linux Script Command Ignores Exit Code on Signal Interrupt

I am using the script command to run a C program that handles SIGINT signals and just exits gracefully. A small example of my C code: #include <signal.h> #include <stdio.h> #include <...
Etchy's user avatar
  • 1
0 votes
0 answers
24 views

How does it work to click on suspended GUIs?

With some GUI program running, then suspended (e.g. launch it from a shell and then hit Ctrl+Z), clicking on some UI element such as a button of course has no effect. However, when the program's ...
OJFord's user avatar
  • 1,848
0 votes
1 answer
64 views

How to send new information to STOPped process

Say I have a long-running process, and I stop and restart it using: kill -STOP <pid> kill -CONT <pid> is there a consistent way to alter the running process, either environment variables ...
Alexander Mills's user avatar
5 votes
1 answer
495 views

How can I make a script echo something when it is paused?

I am pausing a terminal script with SIGSTOP, and I want it to print a message that it is being paused. Since I can't trap the SIGSTOP, I've tried sending a SIGUSR1 before the SIGSTOP and trapping ...
Adam M's user avatar
  • 51
0 votes
2 answers
396 views

Can't Ctrl-C a script after controlling it from another terminal

I'm running blah.sh in one terminal. Then in another terminal, I'm running a script that suspends and later continues blah.sh: ... script_id=`pidof -x blah.sh` kill -s SIGSTOP $script_id ... ...
Adam M's user avatar
  • 1
0 votes
1 answer
491 views

What is the meaning of `kill -0 <pid>`? [duplicate]

I found in a script a call to kill -0 <pid>. It looks like a way to check if process exists. I don't know the exact meaning of kill -0 so I looked for its definition but I didn't find any ...
karlacio's user avatar
  • 101
1 vote
0 answers
479 views

Inside a Docker container, `tini` should be proxying signals to my Java app, but it doesn't seem to be doing so

I'm using tini as my init process to allow me to launch a Java app via a shell script in a container and have my app get signals from Docker when the container is stopped. Given that the problem ...
CryptoFool's user avatar
0 votes
1 answer
66 views

Fail handling SIGINT in hierarchical process execution

I have the following process execution structure: script0.sh script1.sh script2.sh script3.sh Meaning: script0.sh executes script1.sh. script1.sh executes script2.sh and script3....
Dor's user avatar
  • 2,465
0 votes
1 answer
199 views

Does a handled SIGINT affect pipe communication with a child process?

I have an interactive C program that reads a phrase from the terminal, and computes a series of anagrams. I also have a Perl program that reads and buffers lines from STDIN until receiving a reserved &...
Chap's user avatar
  • 359
3 votes
1 answer
379 views

Signal handling in shell script with exec and pipe to filter output with grep

I'm deploying a containerized application which outputs an enormous amount of useless messages on startup (the same message for about a million times, without any variation). The message cannot be ...
Namoshek's user avatar
  • 133
0 votes
1 answer
310 views

Linux Log file for signals

Just wondering any log file I can check in Debian if my colleague sigstop or sigterm my process during I'm away? I've checked syslog, message files. But wasn't able to find any relevant log. Or any ...
Hardguy's user avatar
  • 49
1 vote
1 answer
192 views

Load a process into RAM, but don't execute?

Is there a way to load a process into RAM, but somehow tell the scheduler not to execute it? The aim being to have the system read the binary from disk, allocate the pages in RAM for the code, but not ...
Ralph Bolton's user avatar
1 vote
0 answers
65 views

Under what conditions are unix (Mac OS ) sytem calls restarted after getting interrupted by a signal ? What do the man page mean by "calls committed"?

I'm reading a book on unix systems and I'm at the part where signals are discussed. I'm a bit confused when it comes to what happens when a system call is running and a signal is received. It says ...
user529815's user avatar
0 votes
2 answers
736 views

When is mandatory send SIGINT programmatically?

I know the recommendable way to terminate a foreground process is through the SIGTERM signal, it because it gives the opportunity to the process itself to clean/release resources. This signal only can ...
Manuel Jordan's user avatar
7 votes
1 answer
778 views

What is correct or suggested approach to send the signal name through 'kill' command?

I read many tutorials about the use of kill command, mostly 3 approaches kill -15 <pid> kill -SIGTERM <pid> kill -TERM <pid> For scripts purposes and for portability with macos too, ...
Manuel Jordan's user avatar
4 votes
3 answers
1k views

Why are the signal lists for kill, killall and pkill not the same?

I researched the kill, pkill and killall commands, and I understood most of their differences. However, I am confused about their signals: If I run kill -l, I see: 1) SIGHUP 2) SIGINT 3) ...
Manuel Jordan's user avatar
3 votes
1 answer
1k views

What signal do bg and fg send?

I know that ctrl + z changes a process from foreground to background - as suspended - through SIGTSTP. I am able to re-run that background suspended process through either fg or bg as required. ...
Manuel Jordan's user avatar
1 vote
1 answer
568 views

Signal while SIGSTOP is active

What happens if a process gets a signal after it was stopped by SIGSTOP? I am trying to understand and get a good picture of how this is handled. Unfortunately, all I could find was a short ...
Zoltan K.'s user avatar
  • 473
0 votes
2 answers
550 views

Signals table in /proc/[PID]

I am trying to overwrite or change the Signals of a process. As I guess there is a table of signals in every process separately. Is there anything like that in the /proc folder? Thank you for your ...
superuser's user avatar
2 votes
0 answers
173 views

which signal will caused "wait_event_interruptible" interrupted?

There are wait_event_interruptible in a driver to wait until message is aviliable.But this function was interrupted by a signal. I find out this in manpage: The function will return -ERESTARTSYS if ...
Vencent's user avatar
  • 21
1 vote
1 answer
2k views

Why does a command with a non-zero exit status send an ERR signal even when it is “part of a && or || list”?

man bash includes this documentation for using trap: trap [-lp] [[arg] sigspec ...] … The ERR trap is not executed if the failed command is part of the command list immediately following a ...
Quinn Comendant's user avatar
0 votes
2 answers
245 views

Xlib: what is the best implementation of GUI digital clock?

I am making an X application which contains a digital clock. The clock displays the current time in the format of "hh:mm". I want to master Xlib, so I want to use only Xlib (no other ...
user356126's user avatar
1 vote
1 answer
217 views

How to kill all background and spawned processes of a bash script in its pre-exit handler?

I'm using the wait -n technique to perform max_jobs parallel tasks: #!/usr/bin/env bash cleanup() { echo "cleaning up..." } trap "cleanup" EXIT do_task() { echo "...
Zeta.Investigator's user avatar
1 vote
1 answer
285 views

When terminal emulator exits, why does shell also exits?

When I start a terminal emulator (for example, qterminal), it starts the default shell (for example, bash). And when I quit the terminal (for example, by clicking the x button or by killing the ...
user356126's user avatar

1
2 3 4 5
13