Questions tagged [sigint]

On POSIX-compliant platforms, SIGINT is the signal sent to a process by its controlling terminal when a user wishes to interrupt the process.

Wikipedia: https://en.wikipedia.org/wiki/SIGINT_%28POSIX%29#SIGINT

28 questions
9
votes
1 answer

Why does sleep, when run in a shell script, ignore SIGINT?

When I run sleep manually, and then kill -INT it, sleep exits immediately. For example: $ /bin/sleep 60 & [1] 4002356 $ kill -INT 4002356 [1]+ Interrupt /bin/sleep 60 $ ps -C sleep PID TTY TIME CMD $ However,…
mpb
  • 1,501
  • 1
  • 15
  • 23
5
votes
0 answers

Interrupt a slow gdb command?

I unwisely asked gdb to list all defined functions. (gdb) info function Now it is excitedly slurping up CPU and memory. If I'm really quick about it, GDB will stop with Ctrl-C and give me a prompt again. (gdb) info functions ^CQuit (gdb) But if…
Nathaniel M. Beaver
  • 1,246
  • 13
  • 28
4
votes
1 answer

Just how dangerous is sending SIGINT to resize2fs tasked with shrinking?

I inherited an old PC-server (quad Pentium 4) that only had partitions for /, /boot and swap (RAID1 with 2 1T SATA disks), but needed to update the distro (from CentOS 6.9). I decided to create a new partition so that the one containing / could be…
Roflo
  • 369
  • 4
  • 17
4
votes
2 answers

C SIGINT signal in Linux

I want to make a specific combination of keyboard keys in order to terminate a process e.x I want to terminate the process by pressin CTRL + C ^ 3 (pressing three times C: CTRL +CCC). So basically I want to replace CTRL + C with CTRL + CCC
Albion Shala
  • 123
  • 1
  • 7
4
votes
1 answer

docker-compose, less and SIGINT

I have a script that boots up a test environment using docker-compose. This script pipes the mixed stdout of many docker containers on stdout through less: # This is part of a larger script with some setup and teardown. $ docker-compose up --build |…
Sahib
  • 141
  • 4
3
votes
2 answers

How make CTRL-C work in command line when it does not?

I'm struggling with not working CTRL+C in a certain environment shell command line (CentOS 7 / Vagrant guest of Windows host). I use bash there. The OS, seem, does not matter. Example run sleep 1000 and press the ctrl-c: $ sleep 1000 ^C^C^C So,…
Kirby
  • 161
  • 2
  • 9
3
votes
1 answer

Process started by script does not receive SIGINT

I am on Ubuntu 16.04.5 LTS (AWS) I am creating a python process via this command: nohup python -u main.py > nohup.out 2>&1 & I would like to send a ctrl-c/SIGINT to the process, so I send kill -2 . When I start the process from my terminal,…
Eric
  • 131
  • 4
3
votes
1 answer

How to create a bunch of background processes in terminator terminals later kill them in bash

I'm trying to write a batch script that creates new terminator terminals and then runs a process in each one. I want them to keep running in the background until I decide to kill them. I want the first one to run for 10 seconds and then afterwards…
2
votes
2 answers

Regain ability to use ^C to close backgrounded then (effectively) foregrounded processes

In the interactive console, pressing ^C on zenity --info & fg closes the Zenity window. One can only use zenity --info & wait in a script. But ^C doesn't close the Zenity window in this case. Is there any way to make wait behave more like fg and…
glarry
  • 904
  • 1
  • 7
  • 15
2
votes
1 answer

Legitimate reasons for a program to intercept, internally handle and ignore SIGINT signal

We know that - aside from SIGKILL and SIGSTOP - a program can intercept IPC signals, and run its internal handler circumventing the operation of the default handler. I can think of at least one very good reasons for doing this with the SIGINT…
NetIceCat
  • 2,244
  • 1
  • 14
  • 25
2
votes
1 answer

Stop CTRL+C Exiting Local Script Which is Running tcpdump in Remote Machine

I have setup a simple script like the below: sshpass -p $password ssh -T $username@$ip_address -p 30007 <<- EOF > $save_file.pcap sh tcpdump -i eth5.1 -s 0 -n -v -U -w - EOF sed -i '1d' $save_file.pcap The purpose of this script is so that…
Drew
  • 23
  • 6
2
votes
2 answers

Why does this script keep running after receiving SIGINT?

I learned from https://unix.stackexchange.com/a/230568/674 thatping will exit with 0 after receiving SIGINT, which allows a bash script containing a ping command to continue running instead of exiting. I have a script with similar…
Tim
  • 98,580
  • 191
  • 570
  • 977
2
votes
1 answer

Trap "break" not working while read command is being called

I have this bash-written hangman game for a school project, and currently I am trying to replace the ctrl-c exit command for a while loop break, so the user goes back from the actual game to the categories selection menu. The code I am currently…
1
vote
0 answers

Send SIGINT to a command launched inside bash script

I am executing a bash script and I want to correctly terminate a command (by pressing CTRL+C) that I am launching inside the script. This is the script: trap ctrl_c SIGINT function ctrl_c() { PID = $! kill -s SIGINT -$PID wait $PID echo "mycommand…
juvor
  • 41
  • 1
  • 6
1
vote
0 answers

Why does dmenu block SIGINT propagation?

When running Jetbrains IDEs (such as PyCharm and Android Studio) through dmenu, I get the following warning: The IDE ignores SIGINT: the "Stop" button in run configurations may not work. It then links this support page which says ...it's up to…
cdgraham
  • 111
  • 2
1
2