I have a (C, Linux) application which handles Ctrl-C SIGINT by shutting down.
I'd like to add another signal handler so that I can use another keystroke combo for "reload configuration while running".
So I'm looking from a signal I can send to the foreground process by keystroke, which doesn't force the process to quit or suspend. Are there any others?
You can use ctrl+Z
,
SIGTSTP
Value = 20
For more details refer this link.
You can try Ctrl - \
which is SIGQUIT
if you absolutely need it to be a keystroke (you can catch it).
Your program can use SIGUSR1
and SIGUSR2
to do whatever it wants, but there's no single-stroke way of sending them like how a Ctrl+C sends a SIGINT
signal. You have to use something like kill(1)
to send the signal, e.g. kill -USR1 <mypid>
.