Trapped Signal HUP


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Trapped Signal HUP
# 1  
Old 11-27-2008
Bug Trapped Signal HUP

We encountered an issue in our project while using the Interix UNIX (SFU 3.5) and explained our query below. We would be happy if anybody helps us to troubleshoot the problem J

In our code the trapping signal for all signals like HUP, INT, QUIT, ILL, TRAP, ABRT, EXCEPT, etc., is initialized in the main script. This main script calls the various executable codes and shell scripts which are mostly used to connect the ACR data base and transfer the files from local machine to remote machine.

While execution of our code sometimes we received message like Trapped Signal HUP and sometimes it was executing fine. Could any of you please explain us, why we have received message Trapped Signal HUP in some occurrences and not in some other times for the same executables?


For example,

trap_function()
{
SIGNAL=$1

echo Trapped signal $SIGNAL >> $HOME/Trap.log
trap - $SIGNAL
kill -$SIGNAL $MYPID
}


for SIGNAME in \
HUP \
INT \
;;;;
XCPU \
XFSZ
do
trap "trap_function $SIGNAME" $SIGNAME
done



MYPID=$$

./script1.sh &
./script2.sg &
./script3.sh &
........
......
./exe1 &
.....
./script30.sh &
./exe5 &

Note:All log files which sizes are greater than 200kb will be taken backup.

Last edited by RAMESHPRABUDASS; 11-27-2008 at 08:36 AM..
# 2  
Old 11-28-2008
Signal HUP is generated when the terminal on which the process is running gets disconnected.

You may get this message depending on the network conditions and how you run thsi script.
# 3  
Old 11-28-2008
SIGHUP only goes to the script you wrote when the terminal (with CLOCAL flag set) disconnects or if you send the script process itself a SIGHUP. The trap works in this case.

If SIGHUP is sent directly to the child process it terminates - for example with kill -HUP <pid>, your trap is not executed.
# 4  
Old 12-03-2008
Hi,
The script called from some other script.

we would like to know,what are the various reason to receive HUP signal.
# 5  
Old 12-03-2008
This information is in many books and google, wikipedia.

Is there a more specific question then this? Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Signal trapped during read resumes sleeping

Greetings. This is my first post in this forum; I hope y'all find it useful. One caveat: "Concise" is my middle name. NOT! :D I am almost done with a shell script that runs as a daemon. It monitors a message log that is frequently written to by a database server but it it works my client will... (2 Replies)
Discussion started by: jakesalomon
2 Replies

2. UNIX for Dummies Questions & Answers

Trying to block signal

I have this code that doesnt do what it is suppose to do. It should block signal that I send while process is running. I press control+z while this process is running and it should be blocked but it isnt. When i press control+z it gives me this.... + Stopped When I change SIGTSP into SIGINT then... (5 Replies)
Discussion started by: joker40
5 Replies

3. UNIX for Advanced & Expert Users

need more user signal

Hi In my program I have already used both SIGUSR1 SIGUSR2 user signals. I need another one. How can I do that? Thank you Naama (1 Reply)
Discussion started by: naamabm
1 Replies

4. Solaris

sudo for permission kill -HUP

Hi, I'm trying to provide "/usr/bin/kill -HUP" command to one of the user using sudo file. I have configured sudo as following: $cat /etc/sudoers User_Alias AA=conadmin Cmnd_Alias KILL1=/usr/bin/kill -HUPAA ALL=NOPASSWD:KILL1 When I login as the user and execute 'sudo -l' command, it... (2 Replies)
Discussion started by: mohzub
2 Replies

5. Shell Programming and Scripting

Trapped in pipe

Hi Is there any way to find out in a single step ( command) the step where the pipe command failed when using multiple commands using pipe . eg : ll *.tar | grep dec | grep december.tar the first step is listing all tar files . Second step constitutes piping that data and doing grep... (5 Replies)
Discussion started by: ultimatix
5 Replies

6. UNIX for Dummies Questions & Answers

Help with HUP and SEGV.

Hello - I need to know the detail of HUP and SEGV. I know HUP is Hangup and can be use to kill a Unix login session remotely by sending a hangup signal to the process running the login session. Could someone tell me in detail prupose of HUP and SEGV (segmentation violation)? I need to... (1 Reply)
Discussion started by: namasteall2000
1 Replies

7. Shell Programming and Scripting

Killed by signal 15.

Hi all I have Master script, Main script ,and 4 Child script. Master.sh #!/bin/bash /export/home/user/Main.shMain.sh #!/bin/bash /export/home/user/Child1.sh & /export/home/user/Child2.sh & /export/home/user/Child3.sh & /export/home/user/Child4.sh &I run only Master.sh script... (1 Reply)
Discussion started by: almanto
1 Replies

8. Linux

syslog hup

Hi All, I modified /etc/syslog.conf and execute kill -HUP syslogd_PID. There's nothing changes on the PID when I did ps -ef|grep syslogd. It's the same. Do you think it restarted the process of syslogd? Thanks in advance. (3 Replies)
Discussion started by: itik
3 Replies

9. UNIX for Dummies Questions & Answers

samba, swat. how to send a HUP to inetd ?

solaris can't support pkill command:( (2 Replies)
Discussion started by: cloudsmell
2 Replies

10. UNIX for Dummies Questions & Answers

Hup

I am curious about HUP..... kill -HUP pid What exactly does it do?? Does it stop the process and restart it from the beginning or from where it stopped? Thanks (6 Replies)
Discussion started by: jwbrown
6 Replies
Login or Register to Ask a Question