capture sqsh segmentation fault error


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users capture sqsh segmentation fault error
# 1  
Old 07-24-2009
capture sqsh segmentation fault error

hi all

is there any way to capture the segmentation fault error when i run sqsh on a unix shell script.

Ex:

Code:
 
#!/bin/ksh
sqsh -S "server" -U "user" -P "pwd" << EOF
use mydb
go
exec proc1
go
exit
EOF
retval=$?
echo "sqsh return value $retval"
if [ $retval != 0 ]
then
exit
fi

bcoz of my proc1 i am getting segmentation fault which prints error message only on console, but this error my script is not able to capture. it always print 0 as return value. is there any way to handle this situtation.

i tried this also
Code:
 
#!/bin/ksh
sqsh -S "server" -U "user" -P "pwd" << EOF 2>errfile
use mydb
go
exec proc1
go
exit
EOF
if [ ! -z `cat errfile | grep Segmentation` ]
then
exit
fi

please help.
thanks in advance.
# 2  
Old 07-27-2009
guys,
any suggestions?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies

2. Programming

Segmentation Fault ERROR in C

Hello guys, i have this code: int main(int argc, char *argv) { int i, j, N, result = 0, **vec; if (argc < 2) { fprintf(stderr, "Usage: %s N\n", argv); } /* ... how many numbers to read */ N = atoi(argv); /* check if N is a power of two; exit if not */ if (!... (3 Replies)
Discussion started by: DinisR
3 Replies

3. Programming

Segmentation fault

I keep getting this fault on a lot of the codes I write, I'm not exactly sure why so I'd really appreciate it if someone could explain the idea to me. For example this code #include <stdio.h> main() { unsigned long a=0; unsigned long b=0; int z; { printf("Enter two... (2 Replies)
Discussion started by: sizzler786
2 Replies

4. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

5. UNIX and Linux Applications

How to capture the value returned by a stored proc while executing it from SQSH connection

I have a very simple set up I am connecting to a MS SQL db using SQSH statement from a shell script In this sqsh connection i am trying to execute a stored proc However I want to capture the value returned by the stored proc. I haven't really come across anything useful so far which would... (0 Replies)
Discussion started by: shishirkotkar
0 Replies

6. Programming

getting Segmentation Fault (core dumped) error but Program runs fine.

i am executing following program int main() { char str; FILE * fp; int i=0; ... (4 Replies)
Discussion started by: bhavesh.sapra
4 Replies

7. Shell Programming and Scripting

Segmentation Fault(Core Dump) Error

Hi all, I have a folder with some 28 files. I have a script file that will iteratively take one file at a time from the folder and provide an output for the input file. Till the 7th file, there was no problem but from the 8th file onwards, i got this Segmentation Fault(Core Dump) error. A file... (2 Replies)
Discussion started by: mick_000
2 Replies

8. Programming

segmentation fault

If I do this. Assume struct life { char *nolife; } struct life **life; // malloc initialization & everything if(life->nolife == 0) Would I get error at life->nolife if it is equal to 0. wrong accession? (3 Replies)
Discussion started by: joey
3 Replies

9. UNIX for Dummies Questions & Answers

What's the difference between Segmentation fault and Bus error and Illegal...?

What's the difference between Segmentation fault and Bus error and Illegal instruction? Sometimes I got the one, and sometimes i got another, what are their differences? Segmentation fault (core dump)? Bus error (core dump)? Illegal instruction (core dump) Thanks Daniel (2 Replies)
Discussion started by: lakeat
2 Replies

10. Programming

segmentation fault

sometimes for this code i get a segmentation fault for codes llike this : int main{ int * a= 0; int b; a = (int*)malloc(sizeof(int)); ///some code using these variable but no freeing of a if(a){ free(a); a = 0; } return... (3 Replies)
Discussion started by: wojtyla
3 Replies
Login or Register to Ask a Question