LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 03-27-2009, 06:18 PM   #1
palisetty_suman
Member
 
Registered: Feb 2007
Location: TX, USA
Distribution: fedora
Posts: 191

Rep: Reputation: 33
Thumbs up 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.
 
Old 03-27-2009, 06:36 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,628

Rep: Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641
Quote:
Originally Posted by palisetty_suman View Post
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>"
 
Old 03-27-2009, 07:30 PM   #3
palisetty_suman
Member
 
Registered: Feb 2007
Location: TX, USA
Distribution: fedora
Posts: 191

Original Poster
Rep: Reputation: 33
Thumbs up 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.
 
Old 03-28-2009, 12:35 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,166

Rep: Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680
Forget about 'keyboard' signals.
Just read
man 2 signal
man 7 signal
 
Old 03-28-2009, 12:41 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,628

Rep: Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641Reputation: 7641
Quote:
Originally Posted by palisetty_suman View Post
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....
 
Old 03-28-2009, 01:18 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by TB0ne View Post
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?
 
Old 03-28-2009, 01:38 PM   #7
palisetty_suman
Member
 
Registered: Feb 2007
Location: TX, USA
Distribution: fedora
Posts: 191

Original Poster
Rep: Reputation: 33
Unhappy 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.
 
Old 03-28-2009, 03:29 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by palisetty_suman View Post
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.
 
Old 03-28-2009, 08:09 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
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.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sighup palisetty_suman Linux - Newbie 3 02-22-2009 06:08 AM
SIGHUP / kill -1 SlowCoder Linux - General 6 01-30-2008 06:38 PM
Sending SIGHUP to inetd glansing Linux - Newbie 3 09-16-2005 02:13 AM
How inetd gets sighup? rajesh_b Programming 1 09-17-2004 04:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration