The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 06-05-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
I'm not familiar with db2, but if it's not allowing you to run multiple db2cmd instances at the same time, you will have to serialize them somehow. A common technique is to create a "lock" file in a shared location, and remove it when finished. If the file already exists when you want to create it, back off (maybe sleep for a few seconds) and try again later. How exactly to create a lock file safely depends on your platform etc, but google around for "lock file". If you have Procmail, it comes with a lockfile utility. Maybe db2 already has something similar, actually.

(I thought databases were supposed to solve this problem, though. You can't allow concurrent writes to the same record but some databases allow you to lock just the record(s) you want to write to, and allow another process to write to other records at the same time. Googling for db2 lock brings up some vaguely promising links.)

PS. You might want to go back and edit out the live email link to your Tivoli admin account. I imagine you would not like for it to start receiving spam (maybe it's too late already)