Back |

Creating Schedules

Creating schedules can be useful in many ways.
To use this you need to enable it in the config file and set the path to your scheduler file.

Note: This guide is written for Bec 1.60+

...

[Misc]
Scheduler = Scheduler.xml
...
...


Example of usage:

If the server restarts each morning 0600. you can send warning before this happens.
e.g send a warning 15 min before, 5 min before and 1 min before.

You can create motds to be run on the server.
You can actually have several motd run at different times, in loops or not.
You can run external commands through a bat file or a cmd file to do some work on the server.
In other words. you can do internal commands and external commands.

The scheduler file if basically built up the same way as the admin and command file.
Now lets take a look at the basics of the scheduler file.

<?xml version="1.0"?>
<Scheduler>

    <job id="N">
        <day></day>
<start></start>
<runtime></runtime>
        <loop></loop>
        <cmd></cmd>    
    </job>


</Scheduler>

 

The node <job id is the job holder. the same id number must not be used more than 1 time.
"same as with the admin and command file."

Lets explain the tags inside with job block.

<day> </day>

Define the days you want the schedule to run.

1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
7 = Sunday

You can define a single day or several days.
You Separate each day with a ","

The schedular will only be run on mondays
<day>1</day>

Monday, Wednesday,Friday and Sunday.
<day>1,3,5,7</day>

All days.
<day>1,2,3,4,5,6,7</day>


<Start> </Start>


Define when a schedule should be started and executed.
There are two formats to define time.

Method 1.


<start>HHMMSS</start>

HH = Hour(s)
MM = Min(s)
SS = Sec(s)

<start>001000</start>
This means the schedule should run when 10 min has passed.
The minimum value that can be set is 000000 and max is 999999.

Note: with some numbers there are several ways to define the same time.
Example:
<start>000090</start> is the same as <start>000130</start> -> 1min and 30 sec
<start>009000</start> is the same as <start>013000</start> -> 1h and 30 min

  The format must be 6 ints long.
  even if you only want to run something after 45 sec you need to have all the leading zeros.
  <start>000045</start>

  Method 2.
  <start>18:00:30</start>
  This means that the schedule should be run when the time is 6'o Clock and 30 sec , PM time on the server.

 
  <runtime></runtime>

  This tag uses the same format as the <start> tag method 1 (hhmmss), it also only work when the loop is set to -1 or higher than 0 else it will be ignored
  <runtime>hhmmss</runtime>
  This tag specifies the interval between each loop.

  Example.
  <runtime>001000</runtime>
  <loop>5</loop>

  This means that the job will loop 6 times with a 10 minute delay between each job after the jobstart.
  Once on <start> + number of loops


<loop> </loop>


Defines if the schedule should be repeated or not.

If -1 is used it means it will loop forever.
If 0 is used the job will only be run once.
If 1+ , when a number higher than 0 is used, it will loop the set number of times.

Each loop interval is set in the runtime tag.


<cmd> </cmd>


Defines the command to be used.

<cmd>say -1 Greetings from Bec</cmd>

For external bat/cmd file(s) the full path is needed to be set unless the file are in the Bec directory.
<cmd>c:\tools\schedules\check_updates.cmd</cmd>
Note: when using external files. the current workdir is where Bec is located. Read about it in the Scheduler_FAQ.txt that is in the zip package.


Now lets take a look at a small example.

<?xml version="1.0"?>

<Scheduler>

    <!-- this job will start after 10 minutes and run forever with a 1 hour and 30 minutes interval between the jobs -->
    <job id='0'>
        <day>1,2,3,4,5,6,7</day>
        <start>001000</start>
        <runtime>013000</runtime>
        <loop>-1</loop>
        <cmd>say -1 job:0 forever</cmd>
    </job>

    <!-- this job will start after 30 seconds and will only run once. note that the runtime tag is ignored when loop is 0 -->
    <job id='1'>
        <day>1,2,3,4,5,6,7</day>
        <start>000030</start>
        <runtime>000000</runtime>
        <loop>0</loop>
        <cmd>say -1 job:1 once</cmd>
    </job>
    
    <!-- this job will start after 15 seconds and will run every 25 sec. total times the message will be show is 6 times -->
    <job id='2'>
        <day>1,2,3,4,5,6,7</day>
        <start>000015</start>
        <runtime>000025</runtime>
        <loop>5</loop>
        <cmd>say -1 job:2 six times</cmd>
    </job>

    
    <!-- this job will start at 06:00:00 (6 am) and will only run once a day at set time -->
    <job id='3'>
        <day>1,2,3,4,5,6,7</day>
        <start>06:00:00</start>
        <runtime>000000</runtime>
        <loop>0</loop>
        <cmd>say -1 job:3 once</cmd>
    </job>

    <!-- this job will start at 07:00:00 (7 am) and will repeat itself every 20 min for 3 more time. in total 4 times. will run at set time for defined days -->
    <job id='4'>
        <day>1,2,3,4,5,6,7</day>
        <start>07:00:00</start>
        <runtime>002000</runtime>
        <loop>3</loop>
        <cmd>say -1 job:4 four times</cmd>
    </job>

    <!-- this job will start at 08:00:00 (8 am) and will repeat itself every 15 min forever for defined days -->
    <job id='5'>
        <day>1,2,3,4,5,6,7</day>
        <start>08:00:00</start>
        <runtime>001500</runtime>
        <loop>-1</loop>
        <cmd>say -1 job:5 forever</cmd>
    </job>
    
</Scheduler>


Makes sense ???

BackInstallation and configuration guide