09-06-2012
Good error handling makes for short debug times and happier production support. That is why stderr is always open and unbuffered at the start. Point it at a log file.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,all!
Now ,I write perl for windows platform,and will use signal for asynchronous operations ,but I find it could bring some bugs if it is used incorrectly ,pls help!!! :D (1 Reply)
Discussion started by: hhh101
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
when I execute a script on unix AIX, I've got an error message:
"Execution: 85328 Signal d'alarme".
If I edit this file with "vi", I ve got the same error after a while (about 1 minute).
If I try with another user I still have the problem.
But if I rename this file, no problem.
My... (5 Replies)
Discussion started by: cgsteph
5 Replies
3. Shell Programming and Scripting
Who can explain the meaning of the &2 &1 or @, #, etc in the script?
Is there any document which can explain the usage of these words in details?
for example:
ls /etc/sysconfig/network > /dev/null 2>&1
#@
bash, ksh and sh.
Thanks in advance for ur advice. (1 Reply)
Discussion started by: GCTEII
1 Replies
4. Programming
I am using the signal function, and passing it a function named quit procedure...I get the following warning....
passing arg2 of signal from incompatible pointer type...
void quit_procedure(void); //this is the way i define my prototype...
signal(SIGINT, quit_procedure);
Please guide... (5 Replies)
Discussion started by: jacques83
5 Replies
5. Shell Programming and Scripting
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
6. UNIX for Dummies Questions & Answers
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
7. UNIX for Advanced & Expert Users
Hi,
from my Windows Workstation I can connect with PUTTY to an AIX 6.1 unix server.
On AIX via PUTTY I run DBCA which has a grphical interface.
Then :
#DISPLAY=local_host:0.0 ; export DISPLAY
$(hostname) $(whoami):/appli/oracle/product/10.2.0/db_1/bin#dbca
_X11TransSocketINETConnect()... (12 Replies)
Discussion started by: big123456
12 Replies
8. Programming
A program have to receive signals and work agreed with it, but the process have to receive more than one signal when it is attending other. Those have to be queued to be attended later recived.
how can i do that?
thanks. (2 Replies)
Discussion started by: marmaster
2 Replies
9. Shell Programming and Scripting
Task 1:
#!/bin/ksh
if
then
echo "Usage : $0 Signalnumber PID"
exit
fi
case "$1" in
1) echo "Sending SIGHUP signal"
kill -SIGHUP $2
;;
2) echo "Sending SIGINT signal"
kill -SIGINT $2
;;
3) echo "Sending SIGQUIT signal"
kill -SIGQUIT $2 (3 Replies)
Discussion started by: Ramesh M
3 Replies
LEARN ABOUT HPUX
dtmsglogopenfile
DtMsgLogOpenFile(library call) DtMsgLogOpenFile(library call)
NAME
DtMsgLogOpenFile -- opens a log file
SYNOPSIS
#include <Dt/MsgLog.h>
FILE* DtMsgLogOpenFile(
const char* type,
char** filename_return);
DESCRIPTION
The DtMsgLogOpenFile function calls fopen to open a log file with type open mode. If fopen opens a log file successfully and returns a non-
NULL filename_return, DtMsgLogOpenFile calls malloc to allocate space for filename_return. DtMsgLogOpenFile then copies the log file name
to filename_return.
The caller must use the free function to release the space allocated for filename_return, if it is not NULL. The caller must also close the
file pointer returned by DtMsgLogOpenFile. Use caution in doing this because stderr may be returned.
For a description of the algorithm used to determine the log file to open, see DtMsgLogMessage(3). Note that if a log file cannot be
opened, filename_return will be set to NULL.
ARGUMENTS
type Specifies the file open flag. See fopen(3) for more information.
filename_return
Specifies the variable to receive the returned log file name.
ENVIRONMENT VARIABLES
None.
RESOURCES
None.
ACTIONS
/MESSAGES
None.
ERRORS
/WARNINGS
None.
EXAMPLES
The following code fragment opens the log file, logs the log file name, closes the file, and frees the space allocated for the file name.
char * log_file;
FILE * fp = DtMsgLogOpenFile ("a+", &log_file);
if (log_file) {
DtMsgLogMessage (argv[0], DtMsgLogInformation,
"The log file name is: %s", log_file);
free (log_file);
}
if (fp && fp != stderr)
fclose (fp);
RETURN VALUE
If DtMsgLogMessage completes successfully, it returns a pointer to the opened log file. If it cannot open a log file, it returns stderr.
FILES
None.
SEE ALSO
DtMsgLogMessage(3), DtMsgLogSetHandler(3)
DtMsgLogOpenFile(library call)