Iam having a script which is used to load users and dumpfile in any given schema.Iam trying to autolog the script and have added two fucntion in it.
I have added these two function in the main script.The main script is having two wait command in it.As soon i run the script after adding and calling these two function the script is getting hanged after encoutering the first wait statement of main script.
When i try to check where it is getting stuck i found the process id and saw that it get stuck on process tee -a log file name..Iam not sure why it is getting stuck as it should come out of it. Could someone please help me on it.
Last edited by Scott; 11-29-2012 at 07:47 AM..
Reason: Please use code tags
A FIFO blocks until both ends have been opened. You can't do it one at a time; if you open the read-end first it will wait for the writer, if you open the write-end first it will wait for the reader.
You'll have to put one of the processes in the background first before you can open the other end.
Actually these are the standard fucntion which we are using in all other scripts where it is working fine. Here the difference is that the main script is having two additional wait statement. I am already running the process in background as you could see in the function.
Once all the task is done I check the process and found that process which is not terminated is the one which is teeing the log.
So Iam not sure where it is getting stuck.Could you Adivse me if their is soemthing wrong in this function.
Thanks in Advance.
Last edited by Franklin52; 11-30-2012 at 04:40 AM..
Reason: Please use code tags for data and code samples
That's the thing, it's not really running in the background -- yet. tee doesn't open $OUT_PIPE, redirections are the shell's job. Meaning, before the command gets put into the background, the shell has to open the fifo first. When it tries, it will deadlock, waiting for the other end to be opened.
So you need an entire background shell, not just a background process. It will open the fifo for tee, and your own shell will not need to wait for it. Once the files are opened, the extra shell's not needed and can leave, which is why I use exec instead of running tee directly -- it replaces that extra shell after it's done.
I have tried that too but still getting the same issue. I have attched the entire Script. If possible please have a look at it.Somehow the scrit is getting hanged on the first wait statment in main script and when i check which process is going on its showing the Tee process only.
I have tried the code changes which you asked me to try but still it got stuck on 1st wait process of the main script. Iam using this fucntion in other scripts but their it is perfectly working fine. Only for this function iam facing issue.
Iam using this code only
Code:
# Tee the output pipe into the log file
( exec tee -a $OUT_LOG < $OUT_PIPE >&3 ) &
I am running this code in debug mode and attaching the same.
Hi,
I have run into a problem to which i can't seem to find any solution, posting here is my last resort.
Problem:
I am using plink to access my router and run a few configuration commands. When in enter configurations mode, instead of sending next command plink keeps on waiting for manual... (7 Replies)
Hi All,
I have the requirement that ,i have to write a shell script that job has to wait for a 7 touch files created by another application for 4 hours, if i get all 7 touch files ,i have to send a mail that i jobs are completed, if if it is waiting for more than 4 hours i have to send a mail... (2 Replies)
I have the following code in bash, however "set red frmt" is not displayed.
echo "iarg_rd = $iarg_rd"
iarg_rd="2"
if ; then
echo "Hello World"
fi
if ; then
frmt="${gap}${!frmt_titl_yl}"
elif ; then
frmt="${gap}${!frmt_titl_bk}"
elif ; then
echo... (2 Replies)
I'm looking for some help in figuring why my little bit of code will not process any entries other then the first one in my list.
while read line ;do
hostname=${line//\"}
a=`ssh user@$hostname uptime;echo $?`
if ];then
dt=`date`
touch... (6 Replies)
The code at the bottom is a simplified example of what we have.
If I use the following:
&& echo "echo failed"
$? returns 1
When I use
if ; then echo "echo failed" ; fi
$? returns 0
Does anyone know what's wrong with this?
Using AIX 6.1 and KSH
for NUM in 1 2 3
do
... (5 Replies)
I am getting the following error when I am running a script in ksh when trying to execute an if statement comparing two numerical values
tstmb.sh: 1.5321e+08: 0403-057 Syntax error
Below is my code snippet.
#!/bin/ksh
set -x
TODAY=$(date +%y%m%d)
for file in $(ls -rt *.log | tail... (11 Replies)
Hi,
Here is my code as below:
test.ksh:
=======
#!/bin/ksh
option="${1}"
while
do
case $1 in
-f) FILE="${2}"
echo "File name is $FILE"
;;
-d) DIR="${2}"
echo "Dir name is $DIR"
;;
-*)
echo "`basename ${0}`:usage: | " (5 Replies)
Hello, I have been trying to figure out why the wait isnt waiting for the sleep process to complete till now and have found out that since sleep runs as different process and not a child process the wait isnt waiting.
script:
cat test|while read i
do
echo $i
sleep 30 &
done
wait
ps... (4 Replies)
When running top, I notice a bit more I/O wait time than usual. Is there a tool or piece of software out there that can me help evaluate the performance of these operations on my machine? Thanks! (5 Replies)