1819505 Members
3113 Online
109603 Solutions
New Discussion юеВ

SIGHUP or HUP signal

 
SOLVED
Go to solution
Lacrosse
Regular Advisor

SIGHUP or HUP signal

I am trying to recall the syntax we used to fix a Zombie problem years ago. It involved using the -sighup switch on the startup command for a unidata process in the profile. This prevented the process from spinning off into a zombie when the user dropped off abnormally.....can someone refresh my memory a tell me what the signal was -hup -nohup
-sighup and what was happening here
6 REPLIES 6
Jeff Schussele
Honored Contributor

Re: SIGHUP or HUP signal

Hi,

Number one rule of Zombies - "You can't kill - they're already dead!"

They will eventually be reaped by the OS.

If you're ending up with loads of them, then you need to determine why & fix that. Rule two - the child should be reaped when the parent dies - else it's coded wrong.

To run something so that when the parent exits it remains, then
nohup command [args]
would be the syntax.

Rgds,
Jeff

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: SIGHUP or HUP signal

The only success I've ever had with zombies is kill -9

kill it and its parents.

Not much success at that btw.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Kenneth Platz
Esteemed Contributor

Re: SIGHUP or HUP signal

Are you sure you're not referring to "nohup"?

Ie,

nohup cmd_name &

Will run the command in the background, and will trap the "HUP" signal so it doesn't zombie-fy?
I think, therefore I am... I think!
Pete Randall
Outstanding Contributor

Re: SIGHUP or HUP signal

Hey Hookem!

By definition, zombies do not respond to signals. That means that hup, sighup, sigkill (-9) will have no effect. What you want to do is to nohup the process.


Pete

Pete
Lacrosse
Regular Advisor

Re: SIGHUP or HUP signal

I think Ken had the answer to clarify my question the nohup would prevent them from becoming zombies
Bill Hassell
Honored Contributor
Solution

Re: SIGHUP or HUP signal

man kill (or kill -l to list the signals)


kill -1 or kill -hup (or kill -HUP) will send the hangup signal to a process. The signal's purpose is to notify a program that the connection has been terminated as in a modem hangup. Apparently Unidata doesn't handle this signal without special startup options. You can test to see whether the signal works correctly by using the kill -hup command.

Zombies as Jeff mentioned, are already dead and are caused by bad coding in the parent program. A parent is responsible for all child processes (interesting metaphor...) and must not abandon a child. It must wait until the child terminates, or passes control of the child's termination to init.

nohup is a protector, nothing else. It simply intercepts the SIGHUP signal and throws it away. This would be needed if you started a long process that ran for 5 hours and you wanted to logout and let the process run by itself. The & (background) syntax puts the program into a separate queue but as soon as the parent (typically a shell) exits, it will terminate all children with a SIGHUP. Thus, nohup process_name & will place the program into the background AND ignore the parent's exit. The background process is then assigned to init which performs the proper cleanup of a terminating child.


Bill Hassell, sysadmin