Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jul 14 '11 at 2:01

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 2 down vote accepted

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.)

share|improve this answer
    
That's what I feared. Thanks for the pointer and the answer! –  RoUS Jul 13 '11 at 16:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.