Sponsored Content
Top Forums UNIX for Advanced & Expert Users Trap the EXIT_CODE from a script Post 303019064 by rbatte1 on Friday 22nd of June 2018 08:54:22 AM
Old 06-22-2018
Of course, renaming the original might cause problems. I had to intercept calls to usermod etc. on an old HPUX server once so we could log what was being called. The original (compiled) code was hard-linked for several functions (usermod, useradd, etc.) and reacted differently depending on what name was used to call it.


Perhaps we could suggest many ways of accomplishing this (e.g. with trap or other coding changes) but until we can see what is being called, we're all going to be stuck.


Assuming something checks the value of $? then you could simply add a : or true after the call that may get killed off. Of course, then you don't know when it may have genuinely failed. We need to see (enough of) your code to give you something useful.




Kind regards,
Robin
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to use trap command in shell script

Right now I have implemented autossh between ServerA & ServerB which are sun solaris based. I have made this shell script. I am facing one problem which I am going to discuss now. The problem is when I sftp some files (suppose there is 10 files I have to transfer through sftp) from one server to... (2 Replies)
Discussion started by: girish.batra
2 Replies

2. Shell Programming and Scripting

Trap key press in a script

How can I trap a character press in the shell script. For eg:- I have a script runinng a infinite loops , I will need to quit if q is pressed. I have seen the traping the signal , but they give option only for traping the defined interrupt signals. But those does not help me here. (3 Replies)
Discussion started by: praveenbvarrier
3 Replies

3. Shell Programming and Scripting

Cntl+z Trap is not detecting ??? Help required to add a trap detection ???

Hi folks, I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:.... The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies

4. UNIX for Advanced & Expert Users

trap ctrl c in shell script

how to trap the ctrl c in unix shell script my script is running in while loop it should not be terminate with ctrl c. if i press ctrl c while running script it shloud ignore the same. please healp.......... thanks in advance (2 Replies)
Discussion started by: arvindng
2 Replies

5. Shell Programming and Scripting

Nullify the effect of Trap command in later part of the script

Hi All, i have an issue regarding trap command. i have specified trap function in the beginning of the script to catch some signals but in the later part of the script i want to remove the effect of this. Can anybody help me out of this. for e.g. pressing Ctrl+C for the first time should... (2 Replies)
Discussion started by: vikas_kesarwani
2 Replies

6. Shell Programming and Scripting

How trap a signal in shell script?

Hi , i have a scenario where...i have to put a check where if script is executing more than 15mins i have to kill that script and n retry again 2nd time. i this case i can use background process to do it but i feel trap will be the efficent way to do so... but i dont know much about it... (1 Reply)
Discussion started by: crackthehit007
1 Replies

7. Shell Programming and Scripting

SCRIPT TO TRAP ILLEGAL COMBOS

Hello, I am trying to identify names which are "illegal" in the sense that they do not comply with the spelling norms of a culture. I have written NGrams for initial and final combos which are illegal. These are lists stored in 2 files named Initial and Final. Here are few... (2 Replies)
Discussion started by: gimley
2 Replies

8. Shell Programming and Scripting

Use of stty vs trap in script-driven login menu

My employers would like me to selectively run one of several different (already-existing) Korn Shell menu-driven scripts out of the user's .profile file, depending on some yet-to-be-specified user critieria. I've never done this kind of thing, but I have the existing scripts (among other... (5 Replies)
Discussion started by: Clovis_Sangrail
5 Replies

9. Homework & Coursework Questions

VM trap may work differently than a pure install trap.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: That is the last reply I received from my instructor, and I'm looking for some alternatives. When using... (2 Replies)
Discussion started by: newuser45
2 Replies

10. Shell Programming and Scripting

Trap Oracle error in shell script

sqlplus -s usrname/password@dbSID <<-SQL >> logfile @create_table.sql commit; quit; SQL I am running this script to execute an sql file. I want to display the oracle error if anything found during execution of the sql file and exit from script. Please suggest How do it. (1 Reply)
Discussion started by: millan
1 Replies
TCL_MEM_DEBUG(3)					      Tcl Library Procedures						  TCL_MEM_DEBUG(3)

__________________________________________________________________________________________________________________________________________________

NAME
TCL_MEM_DEBUG - Compile-time flag to enable Tcl memory debugging _________________________________________________________________ DESCRIPTION
When Tcl is compiled with TCL_MEM_DEBUG defined, a powerful set of memory debugging aids is included in the compiled binary. This includes C and Tcl functions which can aid with debugging memory leaks, memory allocation overruns, and other memory related errors. ENABLING MEMORY DEBUGGING
To enable memory debugging, Tcl should be recompiled from scratch with TCL_MEM_DEBUG defined (e.g. by passing the --enable-symbols=mem flag to the configure script when building). This will also compile in a non-stub version of Tcl_InitMemory to add the memory command to Tcl. TCL_MEM_DEBUG must be either left defined for all modules or undefined for all modules that are going to be linked together. If they are not, link errors will occur, with either Tcl_DbCkfree and Tcl_DbCkalloc or Tcl_Ckalloc and Tcl_Ckfree being undefined. Once memory debugging support has been compiled into Tcl, the C functions Tcl_ValidateAllMemory, and Tcl_DumpActiveMemory, and the Tcl mem- ory command can be used to validate and examine memory usage. GUARD ZONES
When memory debugging is enabled, whenever a call to ckalloc is made, slightly more memory than requested is allocated so the memory debug- ging code can keep track of the allocated memory, and eight-byte "guard zones" are placed in front of and behind the space that will be returned to the caller. (The sizes of the guard zones are defined by the C #define LOW_GUARD_SIZE and #define HIGH_GUARD_SIZE in the file generic/tclCkalloc.c -- it can be extended if you suspect large overwrite problems, at some cost in performance.) A known pattern is writ- ten into the guard zones and, on a call to ckfree, the guard zones of the space being freed are checked to see if either zone has been mod- ified in any way. If one has been, the guard bytes and their new contents are identified, and a "low guard failed" or "high guard failed" message is issued. The "guard failed" message includes the address of the memory packet and the file name and line number of the code that called ckfree. This allows you to detect the common sorts of one-off problems, where not enough space was allocated to contain the data written, for example. DEBUGGING DIFFICULT MEMORY CORRUPTION PROBLEMS
Normally, Tcl compiled with memory debugging enabled will make it easy to isolate a corruption problem. Turning on memory validation with the memory command can help isolate difficult problems. If you suspect (or know) that corruption is occurring before the Tcl interpreter comes up far enough for you to issue commands, you can set MEM_VALIDATE define, recompile tclCkalloc.c and rebuild Tcl. This will enable memory validation from the first call to ckalloc, again, at a large performance impact. If you are desperate and validating memory on every call to ckalloc and ckfree is not enough, you can explicitly call Tcl_ValidateAllMemory directly at any point. It takes a char * and an int which are normally the filename and line number of the caller, but they can actually be anything you want. Remember to remove the calls after you find the problem. SEE ALSO
ckalloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory KEYWORDS
memory, debug Tcl 8.1 TCL_MEM_DEBUG(3)
All times are GMT -4. The time now is 02:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy