I don't think you can do this in the manner you're expressing... Since the first file is technically still executing (with a system or fork command) the second file, the OS will (usually) be smart.
You could try to exec the second file in the first one and then exit the first, as it's supposed to fire and not worry about returning. Then your second file could unlink the first one, but I think that's the wrong approach too.
Were I in your shoes, I'd consider a THIRD file to manage the execution of the first two. That way you don't have to jump through any hoops in coping with OS locking. Having that third file self-delete is going to be host related each time, or the second file could remove the management script at some point. |