![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Startup Script "run process with Timer" | zawmn83 | Shell Programming and Scripting | 0 | 08-21-2008 09:57 AM |
| How to include RETURN KEY with Background process "&" in Shell Script | racbern | Shell Programming and Scripting | 1 | 03-11-2008 07:30 AM |
| Q: Recording shell script screen output using "script" command ? | lalfonso.gomez | Shell Programming and Scripting | 4 | 01-18-2007 09:31 PM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 04:15 AM |
| My "Bread and Butter" Process Keep Alive Perl Script.... | Neo | Tips and Tutorials | 0 | 01-08-2005 05:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Shell script process remains after "exit 1"
I have a script that performs an oracle export:
Code:
<snip>
if [ ${exp_type} = FULL ]
then
exp / full=y file=${exp_file} log=${exp_log} direct=y feedback=1000000 STATISTICS=NONE buffer=20000000
else
exp / full=n owner=${schema_name} file=${exp_file} log=${exp_log} direct=y feedback=1000000 STATISTICS=NONE buffer=20000000
fi
if [ $? -ne 0 ]
then
echo "Export command failed"
exit 1
fi
echo "Export command succeeded"
exit 0
Code:
> ps -ef|grep export oracle 23241 1 0 10:04 pts/1 00:00:00 /bin/bash /u01/ct_scr/export.sh TAXTST FULL Y |
|
||||
|
ok, a little more diagnosis:
The Y flag on the script is to indicate whether the dump should be compressed via pipe. executing the script with: "/u01/ct_scr/export.sh TAXTST FULL N" exits just fine. Here's the code for $3=Y: Code:
if [ ${compress} = Y ]
then
pipe_name=${exp_loc}/compress_${ORACLE_SID}_${schema_name:-FULL}_${today}_p
# remove any existing pipe
rm -f ${pipe_name}
# Make a new pipe
/bin/mknod ${pipe_name} p
# initiate compression process on the new pipe to run in the background
gzip -c < ${pipe_name} > ${exp_file}.gz &
# Re-direct export output to the pipe
exp_file=${pipe_name}
fi
Code:
cleanup()
{
if [ ${compress:-N} = Y ]
then
rm -f ${pipe_name}
fi
}
Let me know if I've confused the heck out of you. I'd post the whole script but it's kinda long... |
|
||||
|
Confirmed. feeding the pipe some dummy text (with an implicit EOF) before removing it causes the script to exit correctly:
Code:
cleanup()
{
if [ ${compress:-N} = Y ]
then
echo "fail" >> ${pipe_name}
rm -f ${pipe_name}
fi
}
Does anyone know how to send JUST the EOF to a pipe? I'm hoping that this will cause the background gzip process to exit cleanly without creating a .gz file. |
| Sponsored Links | ||
|
|