The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with signals - 3 process communication Nightwright High Level Programming 2 05-03-2006 05:58 AM
Inter Process File Handling Problem saurabhjain HP-UX 4 05-12-2005 12:49 PM
Interprocess communication using pipes and fork scmay UNIX for Advanced & Expert Users 2 10-14-2004 10:44 PM
signal in process communication a9711 High Level Programming 2 06-22-2002 09:16 PM
Inter Process Communication kamathanil High Level Programming 2 08-07-2001 07:32 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 01-17-2008
adderek adderek is offline
Registered User
  
 

Join Date: Sep 2007
Location: Poland
Posts: 111
Question Inter-process communication:pipes,doors,etc.

Hi,
I am thinking about writing a log daemon for a multi-processed ksh application (yes - I know that high-level language would be a better option).
My question is as follows:
If many processes (many scripts) will try writing to a single log file:
print "message" > common.log
Will it work or is there a risk of collision between them?
If there is such a risk then is it better to use named pipes or doors for such logging system?
And maybe there is some alternative?
  #2 (permalink)  
Old 01-18-2008
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,322
Well, it depends what you do you understand as collision, if the log file will be used for simple messages, then "echo `date` "log this message" >> file.log would be sufficient. Otherwise, for more sophisticated tasks, consider mkfifo, which I see, you are already familiar with.
  #3 (permalink)  
Old 01-18-2008
adderek adderek is offline
Registered User
  
 

Join Date: Sep 2007
Location: Poland
Posts: 111
Maybe I will give you some more details.
I was to take code created by someone else. For logging from several simultaneous processes they are using many log files and from time to time they merge them all into one.
Until now I was thinking that when you are doing:
Code:
print "some even quite long message" >> file.txt
from several processes at once, then it would not interfere.
But they told me that they were receiving logs like:
"log number one
log numbelog number threer two
log number four"
Im ,y understanding this should never occur. But if this is the case then FIFO pseudo-device would be the best choice.
Anyway - I asked because according to my knowledge situation described by the other guy should not occur unless he is doing something like:
Code:
print "log number " >>file.txt
print "one" >>file.txt
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:06 AM.


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