LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 07: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, 07:36 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,933

Rep: Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692
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, 08: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, 01:35 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

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

Rep: Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692Reputation: 3692
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, 02:18 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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, 02: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, 04:29 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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, 09:09 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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 07:08 AM
SIGHUP / kill -1 SlowCoder Linux - General 6 01-30-2008 07:38 PM
Sending SIGHUP to inetd glansing Linux - Newbie 3 09-16-2005 03:13 AM
How inetd gets sighup? rajesh_b Programming 1 09-17-2004 05:38 AM


All times are GMT -5. The time now is 08:54 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration