6

I'm using FC 14, but this is probably a fairly generic Linux question.

I want to be able to bind a key in the Linux terminal driver that will cause a signal other than SIGINT or SIGQUIT to be raised for the running application. I don't want to co-opt either of those. If it rings a bell for you, think along the lines of the old CTRL/T capability, only with the signal being caught and handled by the app rather than the OS.

Since this is for status reporting for long-running activities, SIGUSR1 seems appropriate. However, if specifically raising that from the terminal keyboard isn't an option, I'll take what I can get. I don't want to attempt the impossible and catch SIGKILL B-) but I would like to be able to raise signals other than SIGQUIT and SIGINT from the terminal keyboard.

Scenario:

  1. Set up the terminal to do the signal-raising thing
  2. Run application from shell in terminal window
  3. Wait until it gets into the complex long-running section
  4. Press CTRL/whatzit to raise the signal
  5. Application catches the signal, does some sort of status report, and resumes

I could do this with no problems on VMS/OpenVMS, and it kinda frosts my pumpkins to think it's more difficult on Linux.

1 Answer 1

3

The interface for raising signals via magic characters is, unfortunately, not a generic bind-character-to-signal thing - there are certain specific signals which can be raised like this, and you get to choose the character, but not the signal: see the relevant chapter of the POSIX specification.

(Apart from SIGINT and SIGQUIT, your other option for co-opting a signal is SIGTSTP, if you can live without being able to stop your process with ^Z - which I guess might be the case if you're expecting to leave it running in the foreground anyway.)

1
  • That's what I feared. Thanks for the pointer and the answer!
    – RoUS
    Jul 13, 2011 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .