Introduction

You can use locks to prevent a job starting while another job is running. You can find the information about locks at http://www.sos-berlin.com/doc/en/scheduler.doc/lock.xml

Locks are defined in files in the hot folder (live). Lock file names follow the convention:

To use locks, you have to:

  1. declare a lock
  2. assign the lock to the required jobs

Example

A typical lock declaration would be:

    <locks>
        <lock name="lockSample"/>
    </locks>

To assign the lock to your jobs use:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes"
     stop_on_error="no">
    <lock.use lock="lockSample"
              exclusive="yes"/>
    <script language="shell">
        <![CDATA[
 echo "here is the job jobsSample_1"
 echo "I'm not running in parallel with job jobsSample_2"
 ping -n 60 localhost
         ]]>
    </script>
 </job>
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes"
     stop_on_error="no">
    <lock.use lock="lockSample" exclusive="yes"/>
    <script language="shell">
        <![CDATA[
 echo "here is the job jobsSample_2"
 echo "I'm not running in parallel with job jobsSample_1"
 ping -n 60 localhost
         ]]>
    </script> 
 </job>

Two job chains using the jobs

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain>
    <job_chain_node state="100"
                    job="jobsSample_1"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain>
    <job_chain_node state="100"
                    job="jobsSample_2"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>

Scope of locks