• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to handle file concurrency in UNIX shellscripting

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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

 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic