Script to Start a Job after finding the Old job completed

Hi Experts,

I need a script advice to schedule 12 jobs ( SAS Codes execute back ground ).

Algorithem:

  1. Script checks first job.
  2. Finds first job is done; invoke second job.
  3. finds second job is done; invoke third job.
    ..

Request you to please assist.

Simple thing would be,

  1. At the start of the process, check whether a lock file is there, else create the lock file. Do the process A. At the end delete the lock file.

  2. Do the same for process B, check whether a lock file exist, if it is there, dont start process B, else start and do as similar as step 1.

man wait
DESCRIPTION
      If no argument is specified, wait waits until all processes (started
      with &) of the current shell have completed, and reports on abnormal
      terminations.  If a numeric argument pid is given and is the process

could help you I think.

Try the wait function described in the script 11-24 on this page:

Advanced Bash Shell Scripting Guide - Job Control Commands