Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 11-17-2013, 06:47 PM   #1
Registered: Sep 2012
Posts: 372

Rep: Reputation: 1
When/How to reset trap

I have a script in which I set off sigalrm (14) in a background subscript that kills itself.
Currently I trap for sigalrm prior to entering a forever loop which calls a function to set off the alarm again.
I think I should be resetting the trap command within the loop but am not sure from the documentation.
Should I place a trap <go-to-function> SIGALRM within the loop or should I just reset it in the loop with trap 14?
It is not clear from the man page if reset would use <go-to-function> as the default. If not what is the default destination of the ALRM trap when reset without a user specified destination? Just trying to clarify this trap command, thanks.

Last edited by waddles; 11-17-2013 at 06:49 PM.
Old 11-18-2013, 12:36 AM   #2
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,855

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I think you're going to have to create a mock-up script which follows the execution/function-call-order and place some debug echos in there to figure out exactly what it is doing.
Old 11-19-2013, 04:20 AM   #3
Registered: Sep 2012
Posts: 372

Original Poster
Rep: Reputation: 1
I appreciate the idea of mocking up but feel that I need a tutorial or definitions related to trap-ing.
Please reread the last 4 sentences of #1. Those are the questions I have and feel should be stipulated regarding the trap command.
Old 11-19-2013, 06:27 AM   #4
Didier Spaier
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2 on Lenovo Thinkpad W520
Posts: 7,558

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
In addition to what you see in the SHELL BUILTIN COMMANDS in "man bash", did you read this chapter of the ABS? Did you read this part of the POSIX specification?

Last edited by Didier Spaier; 11-19-2013 at 06:33 AM.
1 members found this post helpful.
Old 11-19-2013, 06:02 PM   #5
Registered: Sep 2012
Posts: 372

Original Poster
Rep: Reputation: 1
Didier, U R always with it, TNX. Yes I had scanned the ABS but was stealing their info on progress bars at the time so am going back cuz I saw some other goodies on that page too.
Wasn't aware of the POSIX specs but am going to have a set down to examine that as well.
THANKS again.


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
Prevent reset of network settings reset after cable unplug Mega-X Linux - Networking 5 01-02-2013 04:58 PM
how to send snmp trap & recieve trap in C program minil Programming 3 07-10-2010 09:22 AM
Install ruby gems - connection reset, connection reset..... deco81 Linux - Software 1 06-16-2010 04:47 PM
How to reset trap msg to write to renamed debug logfile? demxkn66 Programming 1 09-01-2008 06:50 PM
Kernel trap (Fatal trap 12) m!k@EL *BSD 4 09-05-2007 11:58 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:54 PM.

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