The moose likes Linux / UNIX and the fly likes How to handle file concurrency in UNIX shellscripting Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Reply Bookmark "How to handle file concurrency in UNIX shellscripting" Watch "How to handle file concurrency in UNIX shellscripting" New topic
Author

How to handle file concurrency in UNIX shellscripting

sridevi karampudi
Greenhorn

Joined: Dec 17, 2010
Posts: 5


currently if two servers are accesing same file if there is difference between there access time then one server will take the file and process successully, but we are facing ISSUE if there is NO Difference between there access time then two servers are taking the file but one server is processing file and other server is getting stuck and its not able to come out of the script.

But we must handle the scenario, even if two servers access same file at a time , then only one server must be able to take the file and other server must do other file process or must wait for the file.

Please help me in writing the UNIX script to handle file concureny in UNIX . Even if two servers try to access same file simultaneously only one server must be able to take file and process.

Regards,
Sridevi

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

What you need is a semaphore that the different processes can queue up on. This can be done in a shell script, but it's been about 4 years since I looked at it and I don't remember how it's done anymore. About the best I can suggest is google, although I think I may have found it in the bash info file.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
 
 
subject: How to handle file concurrency in UNIX shellscripting
 
Threads others viewed
Memory leaks
Web server and application server
what is the difference b/w WebServer and Application Server?
multi user environment
Opening file from remote machine using authentication
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture