title: Keep a shell or batch file from proceeding until the previous run finishes
body: <p>Is it possible for a batch program and shell script to know if a previous instance of itself is still running and wait until that program ends before triggering the next step in the command line?</p>
  
  <p>We have a bat file and a corresponding shell that is triggered by an application which writes logs into a file, what happens when multiple users use the same application and triggers the program at the same time is that the logs get jumbled and is not readable by the program that turns the log into a PDF.</p>
  
  <p>Thanks.</p>