Sched includes the possibility of excuting Perl scripts at some point of job execution.
You can use result to other task with macro. (ok, err, finish and the hash %result). Job variables are usable in scripts and are replaced before execution.
Script are executed in perl Safe environment. Access is restricted to functions defined in the Script and Cond modules.
ok('id1') $result{'id1'} mailto('${EMAIL}', '${SUBJECT}', 'message') ; max_start_time('+3 hours') ; # 3 hours from the job start max_start_time('23:00') ; # now < today 23:00 open(FP, '>/tmp/test') ; # impossible
The cond field of task and job element is a perl expression evaluated before task execution and at the end of job.
If the condition failed (return undef or also 0), the command will not be executed. If other task are not ended, the condition will be frozen and will be execute when all task where completed.
The field after_cmd of the task is a Perl expression interpreted after the execution of the task. The result of this expression is placed in the after_cmd_status field
If all the dependent tasks are not finished, script fails without being execute.
ok('${ID}') or mailto('root', 'Error on task ${ID}', 'This task was ..') ;
�
Macro | Information | Example |
---|---|---|
ok('task_id') | Return true if task_id have an exit code equal to 0. | ok('test1') |
err('task_id') | Return true if task_id have an exit code different of 0. | ok('id1') && err('id2') |
finish('id') | Return true if id is finished. | finish('id2') |
job_end([status [,info]]) | Send a TERM signal to the job. | job_end(1) if err('id1') |
mailto(to,subject,msg) | Send mail. | mailto('root', 'sub', 'msg') |
max_start_time(date) | Return true if the date specified on argument is on the future. | max_start_time('12:00') |
master_connection_is_ok() | Return true if master connection is ready | master_connection_is_ok() |
Eric 2005-12-17