Operating System - Linux
1752785 Members
6230 Online
108789 Solutions
New Discussion юеВ

Re: diff b/w HUP, TERM, INT signals

 
SOLVED
Go to solution
Maaz
Valued Contributor

diff b/w HUP, TERM, INT signals

Hello Dear Experts

what are TERM, INT, KILL, HUP, USR1 signals ??
and what is the diff b/w them.

KILL signal is obvious to me, but others are not ... so plz help


Any help will be highly appreciated .

Thanks in advance

Regards
Maaz
7 REPLIES 7
Olivier Drouin
Trusted Contributor

Re: diff b/w HUP, TERM, INT signals

# man 7 signal

Signal Value Action Comment
-------------------------------------------------------------------------
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating point exception
SIGKILL 9 Term Kill signal
SIGSEGV 11 Core Invalid memory reference
SIGPIPE 13 Term Broken pipe: write to pipe with no readers
SIGALRM 14 Term Timer signal from alarm(2)
SIGTERM 15 Term Termination signal
SIGUSR1 30,10,16 Term User-defined signal 1
SIGUSR2 31,12,17 Term User-defined signal 2
SIGCHLD 20,17,18 Ign Child stopped or terminated
SIGCONT 19,18,25 Continue if stopped
SIGSTOP 17,19,23 Stop Stop process
SIGTSTP 18,20,24 Stop Stop typed at tty
SIGTTIN 21,21,26 Stop tty input for background process
SIGTTOU 22,22,27 Stop tty output for background process



There are others... see the man page.

HUP for a daemon is to reload the config.

Maaz
Valued Contributor

Re: diff b/w HUP, TERM, INT signals

Many Thanks Dear Olivier.
As per ur instruction i check with man page, but for me it was a bit difficult to understand directly from the man page ... might be due to the techincal english, or at least for me might be the man page for signal is not that easy

So anyone can plz explain only those signals which I have already asked for in the post. i.e. what are TERM, INT, KILL, HUP, USR1 signals ?? and what is the diff b/w them.

Thanks

Regards
Maaz
Paul_503
New Member
Solution

Re: diff b/w HUP, TERM, INT signals

Maaz, hi

I'll try give you a basic summary of the signals:

TERM - Terminate - This signal you send if you want to end a process. It allows the process to clean up nicely though, not like the -9 option (KILL) which just ends everything.

INT - Interrupt - This is a permission which for instance can be used in an NFS environment. If a process hangs, you can interrupt it with say the Ctrl C option.

KILL - exactly what it says. It kills a process without allowing it to clean up, meaning, end all threads, kill child processes etc. It just stops it and can leave either files or other processes in an inconsistant state.

HUP - Hang UP - What this signal does is, when you send it to say the inetd process, it basically tells inetd to go reread it's configuration file as certain changes have been made which you have to incorporate now. The process doesn't actually stop, it just, like stated, rereads it's config.

USR1 - This is a user defined signal. For instance, on our Tru64 systems, we use this signal to tell say the binary log daemon to go save it's current log file, archive it, and then start a new one. I imagine though it could be used for many other things, thus user defined.

I hope this helps a little bit. If not, let me know and I'll try extend my explanations.
Maaz
Valued Contributor

Re: diff b/w HUP, TERM, INT signals

Thanks a Million Dear Paul for such a great explanation. I m highly thankful to u.

i jus wana know one more thing, that is how i can send the process TERM, INT, and HUP signal. i know that kill signal is given by
#kill -9 pid,
but i wana know what command is used to give TERM, INT, and HUP signals to any process.

Regards
Maaz
Stuart Browne
Honored Contributor

Re: diff b/w HUP, TERM, INT signals

You can use kill to send either the numerical or the textual signal to a process id, i.e.

kill -1 832
kill -HUP 832

are equivalent.

kill -2 832
kill -INT 832

are equivalent.

The first list, given by Oliver gives both the textual and numerical signal values. Choose which you prefer to use, and go with it.

Personally, I like the textual values.

NOTE: Sending anything the 'KILL' signal (kill -9 , or kill -KILL ) should only ever be used as a last resort! You should always start with a less harmful signal (TERM or INT or QUIT).
One long-haired git at your service...
Olivier Drouin
Trusted Contributor

Re: diff b/w HUP, TERM, INT signals

HUP - Hang UP - What this signal does is, when you send it to say the inetd process, it basically tells inetd to go reread it's configuration file as certain changes have been made which you have to incorporate now. The process doesn't actually stop, it just, like stated, rereads it's config.

This is true only for daemon processes. For normal application it hangs-up the terminal. It comes from the old days of the modem...

Since there is no terminal attached to a daemon they used this signal instead of USR1 and USR2 for re-reading the daemon's configuration. It frees up a signal.
Maaz
Valued Contributor

Re: diff b/w HUP, TERM, INT signals

Dear Stuart Browne I m highly thankful to u for the kind reply/help, and the great explanation.

and Dear Olivier Drouin, the explanation u provided me is so precious to me, thankx a million.

once again Many Thanks for the continous support.

Regards
Maaz