flock(1) というコマンドがあります。flock(2) を使い、コマンドを排他制御して実行します。

$ flock /path/to/lockfile command...

これで lockfile をロックファイルとしてコマンドを排他制御実行します。

Read the rest of this entry