The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
"find command" to find the files in the current directories but not in the "subdir" swamymns Shell Programming and Scripting 9 07-22-2008 12:23 PM
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 03:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
Unix "at" / "Cron" Command New Problem...Need help Mohanraj UNIX for Dummies Questions & Answers 3 01-26-2006 08:08 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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-19-2005
johnnieb johnnieb is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 1
multipe shells spawned with "ps" command

I have a small function that I use to see if another version of the script is currently running. Occasionally, about 10% of the time, it reports that two instances of the script are currently running. Since I am using a unique name, I know that there is not another version running out there by another user.

I created a test script to capture some data. It appears as though "ps" is occasionally spawning a child shell. I have run the same test script on other AIX servers and have not been able to repeat it on them.

**********
AIX LEVEL
**********
/tmp>/usr/bin/rpm -qa | grep AIX
AIX-rpm-5.2.0.40-1

**********
TEST SCRIPT
**********
#!/usr/bin/sh
function p_check
{
PGM=$1
##myCNT=$(ps -ef | tee junk | grep -v grep | grep -c $PGM)
myCNT=$(ps -ef | tee junk | grep $PGM | grep -v grep | wc -l | awk '{print $1}')
rc=$?

if [[ $myCNT != "1" ]]; then
echo "$PGM is already running.($myCNT)"
echo "rc = $rc"
exit 100
fi
}

p_check "checkPS2.sh"


********************
OUTPUT FROM SCRIPT
********************
tmp>checkPS2.sh
tmp>checkPS2.sh
tmp>checkPS2.sh
checkPS2.sh is already running.(2)
rc = 0


************************************
SEARCH OF OUTPUT FILE (when problem occurs)
************************************
tmp>grep checkPS junk
edat 10618 36204 1 09:50:57 pts/0 0:00 /usr/bin/sh checkPS2.sh
edat 36204 17852 1 09:50:57 pts/0 0:00 /usr/bin/sh checkPS2.sh
edat 51188 10618 0 09:50:57 pts/0 0:00 grep checkPS2.sh

tmp>grep pts\/0 junk
UID PID PPID C STIME TTY TIME CMD
edat 17852 28470 0 15:36:44 pts/0 0:00 -ksh
edat 36204 17852 1 09:50:57 pts/0 0:00 /usr/bin/sh checkPS2.sh
edat 10618 36204 1 09:50:57 pts/0 0:00 /usr/bin/sh checkPS2.sh
edat 48266 10618 0 09:50:57 pts/0 0:00 tee junk
edat 51188 10618 0 09:50:57 pts/0 0:00 grep checkPS2.sh
edat 16540 10618 3 09:50:57 pts/0 0:00 ps -ef

******************************************
SEARCH OF OUTPUT FILE (when problem does not occur)
******************************************
tmp>grep pts\/0 junk
edat 17852 28470 1 15:36:44 pts/0 0:00 -ksh
edat 50054 17852 1 10:20:01 pts/0 0:00 /usr/bin/sh checkPS2.sh
edat 50400 50054 0 10:20:01 pts/0 0:00 awk {print $1}
edat 52060 50400 0 10:20:01 pts/0 0:00 tee junk
edat 48634 50400 0 10:20:01 pts/0 0:00 grep checkPS2.sh
edat 48354 50400 4 10:20:01 pts/0 0:00 ps -ef

We updated the libc.a library to match that of the other servers but that did not resolve the problem.

Am I simply facing a race condition here or is there more than meets the eye?

Thanks in advance.

Last edited by johnnieb; 10-19-2005 at 11:26 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:07 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0