Skip to end of metadata
Go to start of metadata


After the run of a job chain, the order log should be sent as an attachment of an email instead to receive a mail per job that has been executed during the job chain.


You can achieve this by adding a step with an sendEmail-Job at the end of the job chain. See the example below.

How it works

The JITL-Job JobSchedulerManagedMailJob is used to send the email. The parameter attachment will be set by the post processing script. The postprocessing set the name of file using the api method spooler.log_dir, the order_id and the job chain name provided by the order object. The name of the order log has the format $log_dir/order.<job_chain_path>.<order_id>.log where the job chain path have , instead of /.


In this example, the order log will be sent in case of a succesfull execution of the job chain.



Example shell script exit function
<job title="Send Mails" order="yes" stop_on_error="no" name="SendMail">
 <description >
 <include file="jobs/JobSchedulerManagedMailJob.xml"/>

 <params >
 <param name="to" value=""/>

 <param name="subject" value="order log"/>

 <script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedMailJob"/>

 <monitor name="process1" ordering="1">
 <script language="java:javascript">
function spooler_process_before(){
 var order = spooler_task.order;
 var job_chain = order.job_chain.path;
 job_chain = job_chain.substring(1);
 job_chain = job_chain.replace(/\//g,",");

 var f = spooler.log_dir + "/order." + job_chain + "." + + ".log";;
 return true;

 <run_time />



Write a comment…