Skip to end of metadata
Go to start of metadata


How can a job, which is only to run once, be started immediately and not be restarted the next time JobScheduler is restarted?


The following script will start a job immediately and ensure that it will not be restarted:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job  title="run once job example" stop_on_error="no" order="no">
    <script  language="shell">
 echo run once
    <monitor  name="DeleteObjectFileAfterExecution" ordering="99">
        <script  language="javax.script:rhino">
 function spooler_task_after() {
    <run_time  once="yes"/>

The key here is an "undocumented" JobScheduler feature: once="yes".
This starts the job immediately, even once JobScheduler has started.
The job is deleted by the post-processor (function spooler_task_after()) in order to ensure that it will not be restarted the next time JobScheduler itself is restarted.

The post-processor can be omitted if it is not necessary to delete the job.

Insert the code for script that is to be executed in place of "echo run once".

This solution means that it is no necessary to use a timestamp as a workaround.


Write a comment…