LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-12-2008, 05:09 AM   #1
NubKnacker
LQ Newbie
 
Registered: May 2008
Posts: 8

Rep: Reputation: 0
Multiple sh instances created on RHEL4


Hi,

I'm unsure if this is the correct forum for such a question so please feel free to move the thread if it isn't.

We compile CSV's into postgres using the psql COPY command. This is all done through the command, "sh -c `psql <psql parameters>`". The list of CSV's may vary so this command is executed via java which verifies certain CSV details (among other things) before executing the COPY command along with the filename.

This was all working fine and dandy for a year until last week when suddenly it stopped. After 3 days of debugging we finally realised that instead of spawning one instance of the 'sh' command, 2 or 3 of them were being created which caused postgres to enter into a race condition. We figured this was due to java misbehaving so went on a bug hunt. Another 2 days later we finally realised that it wasn't java which was the problem. It appears that the 'sh -c' command creates childs of itself (I was able to see this using ps -H) for no reason.

Is it possible for the shell to misbehave in such a manner or am I overlooking something?
 
Old 05-13-2008, 06:15 PM   #2
rlhartmann
Member
 
Registered: Mar 2008
Posts: 73

Rep: Reputation: 16
Quote:
"sh -c `psql <psql parameters>`"
Are you running this from a shell script already?
Why do you need the sh -c at all? If psql is a command, just
run
psql <psql parameters>

If you really need the sh -c, take away the ticks, they are another
child process, use single or double quotes, add a \ in front of quotes
inside the psql parameters string if necessary;
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple instances tekmann33 Linux - Newbie 1 01-28-2008 03:05 PM
kickstart; how-to info needed for multiple instances of RH OS's and multiple unique v Joe_Wulf Linux - Server 4 06-21-2007 11:18 PM
SAMBA: Multiple Instances? Matir Linux - Software 0 02-18-2005 10:43 AM
Multiple Instances of MPlayer? Levitate Linux - Software 2 01-13-2005 12:04 PM
Multiple instances of PHP cubax Linux - Newbie 6 12-30-2004 08:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration