LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sighup (https://www.linuxquestions.org/questions/linux-newbie-8/sighup-714955/)

palisetty_suman 03-27-2009 07:18 PM

Sighup
 
Hi we have ctrl-c key stroke to generate SIGINT signal. Then whats the key stroke for SIGHUP signal. I had to use in the script. Please help.

TB0ne 03-27-2009 07:36 PM

Quote:

Originally Posted by palisetty_suman (Post 3490069)
Hi we have ctrl-c key stroke to generate SIGINT signal. Then whats the key stroke for SIGHUP signal. I had to use in the script. Please help.

Please write more clearly...your question is hard to follow.

SIGHUP, like many other signals, is not tied to any particular key on the keyboard, unlike SIGINT (the <CTRL>-C), and others that are supposed to come from the TTY.

In the old days, it was common to dial up a computer from your terminal and log in, the same way you log in on a virtual console after pressing, say, <CTRL><ALT><F1> to get to that virtual console in the first place. No PPP, no Internet, no network connection at all. You can still configure your Linux system to accept phone calls via your modem and directly present the caller with a login screen. Once the user logs in this way, he gets a shell prompt. He can then run programs.

If, during the running of a program, the modem disconnects, the program receives SIGHUP. HUP stands for "hang up", as in hang up the phone.

So if you want to go to that trouble, you generate a SIGHUP that way.

You can also generate a SIGHUP for a particular process number x by going to another virtual terminal or xterm window and typing at the shell prompt "kill -HUP <PID>"

palisetty_suman 03-27-2009 08:30 PM

hI TBONE
 
Hi i have to write a program to show the working of signals. I have written like this for SIGINT and SIGQUIT. But not sure for how to continue it for using SIGHUP. What is the program here should be for SIGHUP.

#include <stdio.h>
#include <signal.h>
#include <sys/wait.h>

void sigproc();

main()
{
signal(SIGINT, sigproc);
sigproc(SIGQUIT, sigproc);
for(;;)
{
PRINTF("SUMAN");
}
}

void sigproc()
{
printf("you have pressed ctrl-c \n");
void sigproc()
{
printf("you have pressed ctrl-\ \n");
}

I am asking how to make it for SIGHUP. Please help.

chrism01 03-28-2009 01:35 AM

Forget about 'keyboard' signals.
Just read
man 2 signal
man 7 signal

TB0ne 03-28-2009 01:41 PM

Quote:

Originally Posted by palisetty_suman (Post 3490122)
Hi i have to write a program to show the working of signals. I have written like this for SIGINT and SIGQUIT. But not sure for how to continue it for using SIGHUP. What is the program here should be for SIGHUP.

I am asking how to make it for SIGHUP. Please help.

And I told you...but you apparently didn't read my first post:

Quote:

SIGHUP, like many other signals, is not tied to any particular key on the keyboard, unlike SIGINT (the <CTRL>-C), and others that are supposed to come from the TTY.
SIGHUP isn't tied to a keyboard command, like alot of other signals are, which is why I posted what I did. ChrisM also posted good info too.

And this very much sounds like homework....

pixellany 03-28-2009 02:18 PM

Quote:

Originally Posted by TB0ne (Post 3490751)
And this very much sounds like homework....

As do most of OP's posts.......

palisetty;
I think we're starting to see a pattern here--are you planning to simply use LQ as a homework service?

palisetty_suman 03-28-2009 02:38 PM

HI
 
Yes it is my home work but i asked you only after i tried and even i wrote what i got. So whats wrong? You told that OP's have to try first and to show what they did before asking for homework. So i did not get where i did wrong.

pixellany 03-28-2009 04:29 PM

Quote:

Originally Posted by palisetty_suman (Post 3490810)
Yes it is my home work but i asked you only after i tried and even i wrote what i got. So whats wrong? You told that OP's have to try first and to show what they did before asking for homework. So i did not get where i did wrong.

Please know that I am giving you the benefit of the doubt here.....With that in mind, look at your first post in this thread. You did not give any evidence of having looked for the answer (eg a search here or on Google).

I think the issue is that your posting history gives the impression that you are simply relaying the homework questions as you get them.

Tinkster 03-28-2009 09:09 PM

And I'm closing this thread now ... this chap is a very
persistent "homework question poster", and violating our
rules pretty much in every thread.


All times are GMT -5. The time now is 11:27 PM.