in reply to Locking files
If I understand you correctly, you want to allow only one invocation of you script running at the same time. If this is the case, then take a look at Highlander - there can be only one!!
-- Hofmator