LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-25-2006, 10:52 PM   #1
smoothdogg00
Member
 
Registered: Feb 2006
Location: Maine
Distribution: Ubuntu
Posts: 44

Rep: Reputation: 15
Help writing a shell script!


I need to write a shell script that determines what happens when the '>>' (append) operation accesses a file at the same time as another program. For example:

If two users logged on at the same time and a logfile was being written with the '>>' operation, does the file get accessed by both at the same time, therefore one is overwritten by the other becuase they were working on the same line, or does it wait?

I just need ideas for how to test this, not the actual answer. Thank you.
 
Old 04-25-2006, 10:56 PM   #2
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 60
Sure sounds like homework.
 
Old 04-25-2006, 10:57 PM   #3
smoothdogg00
Member
 
Registered: Feb 2006
Location: Maine
Distribution: Ubuntu
Posts: 44

Original Poster
Rep: Reputation: 15
Haha...yes indeed, but I am lost as to how to do it. I understand the concept, but am not sure how to launch two processes at the same time.
 
Old 04-25-2006, 11:03 PM   #4
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
You could utilize the at deamon or even cron, but at would probably work better for you. Just add two jobs that write different output to the same file. By the system clock they will be simultaneous.

Regards,

Alunduil
 
Old 04-25-2006, 11:30 PM   #5
sailu_mvn
Member
 
Registered: Sep 2004
Location: Hyderabad
Distribution: FEDORA,REDHAT,HOST
Posts: 440
Blog Entries: 1

Rep: Reputation: 30
i dont think that buffer for the both the instances at the same time. are u taking the log froma a single system?
 
Old 04-26-2006, 11:15 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,290

Rep: Reputation: 174Reputation: 174
open two xterms

and do
cat >> file

and what you type will go in the file.

or
find . >> file

whatever

Last edited by bigearsbilly; 04-26-2006 at 11:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing a shell script tchoua Linux - General 8 02-24-2005 06:18 PM
shell script writing ust Linux - General 6 01-24-2005 01:06 PM
writing my first shell script speedhead34 Linux - Newbie 4 12-20-2004 12:50 AM
help writing shell script np complete Linux - Newbie 6 08-30-2004 09:43 PM
Need Help in Writing a Shell Script. KptnKrill Linux - General 2 05-19-2003 05:44 AM


All times are GMT -5. The time now is 07:45 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration