05-22-2003
Background processes return 127 sporadically
I have created a shell script that spawns multiple background processes (spawns sqlplus application). I use an array to capture the process id of those background processes. I then loop through the array and issue a 'wait' command to wait on the process id that was captured in the array. I am getting sporadic results where some of the background processes return an exit code of 127.
It seems possible that it may be related to the OS because I get different results on different machines. Sun OS 5.6 I get sporadic results. Sun OS 5.8 seems to be OK.
Output results to show inconsitency:
--Run 1
Process: 0 PID: 13718 Return Value of: 0
Process: 1 PID: 13721 Return Value of: 0
Process: 2 PID: 13724 Return Value of: 0
Process: 3 PID: 13727 Return Value of: 127
Process: 4 PID: 13730 Return Value of: 0
--Run 1
Process: 0 PID: 20849 Return Value of: 0
Process: 1 PID: 20852 Return Value of: 127
Process: 2 PID: 20855 Return Value of: 127
Process: 3 PID: 20858 Return Value of: 127
Process: 4 PID: 20861 Return Value of: 0
--Run 1
Process: 0 PID: 21688 Return Value of: 0
Process: 1 PID: 21691 Return Value of: 0
Process: 2 PID: 21694 Return Value of: 127
Process: 3 PID: 21697 Return Value of: 0
Process: 4 PID: 21700 Return Value of: 0
--Run 1
Process: 0 PID: 23945 Return Value of: 0
Process: 1 PID: 23948 Return Value of: 0
Process: 2 PID: 23951 Return Value of: 0
Process: 3 PID: 23954 Return Value of: 0
Process: 4 PID: 23957 Return Value of: 0
Any ideas?????
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
How do you capture the return code from a background process?
I am dumping data to a fifo and then processing it in a c program.
I need to know that the sql finished successfully to ensure no missing data. Thanks.
ex.
sqlplus user/password < get_data.sql > data_fifo.txt &
bin/process_data... (2 Replies)
Discussion started by: korndog
2 Replies
2. Shell Programming and Scripting
hi there,
here's what i need in my korn-shell:
... begin korn-shell script
... nohup process_A.ksh ; nohup process_B.ksh &
... "other stuff"
... end lorn-shell script
in plain english i want process A and process B to run in the background so that the script can continue doing... (6 Replies)
Discussion started by: jacob_gs
6 Replies
3. Shell Programming and Scripting
I'm trying to do the following:
1) Run a bunch of jobs in the background
2) Determine if any one of them returns with a non-zero exit status
Here's what I've come up with so far:
##########################################
#!/bin/ksh
while } -lt 1024 ]
do
SLEEP_TIME=`expr 1024 -... (2 Replies)
Discussion started by: bergerj3
2 Replies
4. Linux
Hi!
First of all, let me warn you I'm quite new to the world of LINUX and Operating Systems understanding, so that's why I pose these newbie and stupid qustions...
Anyway, I'm trying to build my own simple shell in C and I'm getting some problems in implementing the background process ('&')... (10 Replies)
Discussion started by: neimaD
10 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Inorder to improve the performance, I am trying to execute my command as a background process..
For eg: To zip large numbers of files present in a directory instead of using a single process, i do follow the below method:
gunzip -c > / &... (3 Replies)
Discussion started by: unni.raj
3 Replies
6. Solaris
Hi,
I need to establish a procedure that will start an application in background each time my remote Solaris server is (re)started. This would be a kind of daemon. I am no sysadmin expert, so I am looking for pointers.
How should I proceed? What are the main steps?
Thanks,
JVerstry (9 Replies)
Discussion started by: JVerstry
9 Replies
7. Shell Programming and Scripting
Ok guys so I have my first dummy shell almost done except for one tiny part: I do not know how to run a process in the background, from the code!
I already know how to do that in a normal shell:
$ program &
However, no clue when it comes to how to program that thing. :eek:
A very... (2 Replies)
Discussion started by: Across
2 Replies
8. Shell Programming and Scripting
Hi,
I have a schell script parent.ksh from which I am calling three background processes a.ksh,b.ksh and c.ksh. Once these three processes completes the next step in parent.ksh should execute. How to achieve this?
Please help me....
Thanks... (1 Reply)
Discussion started by: ravinunna
1 Replies
9. UNIX for Advanced & Expert Users
Hi All,
I am trying to create background processes and then check their status later. But I am getting return codes as 0,127 randomly
On checking the return codes for wait, I found the below. Do I need to treat return code of 127 as successful as well?? as we know the process id passed is... (7 Replies)
Discussion started by: tostay2003
7 Replies
10. UNIX for Advanced & Expert Users
How do I list the process in a Unix based system which are running in background?
The following are options that I'm aware of, but they may not be appropiate.
a. using ps -ef , and getting records of processes for which STATUS='S'(uninterruptible sleep)
b. using jobs -l, and filtering... (5 Replies)
Discussion started by: kumarjt
5 Replies
PS(1) General Commands Manual PS(1)
NAME
ps - process status
SYNOPSIS
ps [-alxU] [kernel mm fs]
OPTIONS
-a Print all processes with controlling terminals
-l Give long listing
-x Include processes without a terminal
EXAMPLES
ps -axl # Print all processes and tasks in long format
DESCRIPTION
Ps prints the status of active processes. Normally only the caller's own processes are listed in short format (the PID, TTY, TIME and CMD
fields as explained below). The long listing contains:
F Kernel flags: 001: free slot 002: no memory map 004: sending; 010: receiving 020:
inform on pending signals 040: pending signals 100: being traced.
S State: R: runnable W: waiting (on a message) S: sleeping (i.e.,suspended on MM or FS) Z:
zombie T: stopped
UID, PID, PPID, PGRP The user, process, parent process and process group ID's.
SZ Size of the process in kilobytes.
RECV Process/task on which a receiving process is waiting or sleeping.
TTY Controlling tty for the process.
TIME Process' cumulative (user + system) execution time.
CMD Command line arguments of the process.
The files /dev/{mem,kmem} are used to read the system tables and command line arguments from. Terminal names in /dev are used to generate
the mnemonic names in the TTY column, so ps is independent of terminal naming conventions.
PS(1)