Back |
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.
...
[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">
<time></time>
<delay></delay>
<day>1,2,3,4,5,6,7</day>
<loop></loop>
<cmd></cmd>
<cmdtype></cmdtype>
</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.
<time> </time>
Define when a schedule should be run.
There are two formats to define time.
Method 1.
<time>HHMMSS</time>
HH = Hour(s)
MM = Min(s)
SS = Sec(s)
<time>001000</time>
This means the schedule should run when 10 min has passed.
The minimum value that can be set is 000001 and max is 999999.
Note: with some numbers there are several ways to define the same time.
Example:
<time>000090</time> is the same as <time>000130</time> -> 1min and 30 sec
<time>009000</time> is the same as <time>013000</time> -> 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.
<time>000045</time>
Method 2.
<time>18:00:30</time>
This means that the schedule should be run when the time is 6'o Clock and 30 sec , PM time on the server.
<delay> </delay>
The delay tag uses same format as the <time> tag method 1.
<delay>HHMMSS</delay>
All this does is to put a delay on the startup of the schedule/job. Meaning you can have several jobs starting at the same time but with delay on them.
This tag will only work when the time tag uses method 1. HHMMSS.
When a Schedule/Job uses the delay it will only delay the starup. if you have the schedule/job on a loop. it will not delay after the first run.
<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 Seperate 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.
<day1,2,3,4,5,6,7</day>
<loop> </loop>
Defines if the schedule should be repeated or not.
You can only use value 0 or 1.
Value 0 means no repeat of the schedule, "turned off looping".
Value 1 means repeat of the schedule, " turned on looping"
If you have set the time of the schedule to be run at a certain time of the day the loop will be ignored.
you will need to set it to 0 or 1.
<cmd> </cmd>
Defines the command to be used.
Internal commands its limited down to thise:
say, loadbans, writebans, loadscripts, #shutdown, #restart, #reassign, #lock, #unlock, #mission
<cmd>say -1 Greetings from Bec</cmd>
For external bat/cmd file(s) the full path is needed to be set.
<cmd>c:\tools\schedules\check_updates.cmd</cmd>
<cmdtype> </cmdtype>
Defines if its internal or external schedule.
You can only use value 0 and 1.
Value 0 means its a internal command to be run
Value 1 means its a external command to be run
Now lets take a look at a small example.
<?xml version="1.0"?>
<Scheduler>
<!-- INTERNAL COMMANDS -->
<job id="0">
<time>05:50:00</time>
<delay>000000</delay>
<day>1,2,3,4,5,6,7</day>
<loop>0</loop>
<cmd>say -1 Server will Auto restart in 10 min</cmd>
<cmdtype>0</cmdtype>
</job>
<job id="1">
<time>05:55:00</time>
<delay>000000</delay>
<day>1,2,3,4,5,6,7</day>
<loop>0</loop>
<cmd>say -1 Server will Auto restart in 5 min</cmd>
<cmdtype>0</cmdtype>
</job>
<job id="2">
<time>06:00:00</time> <!-- run at 6'o Clock in the morning -->
<delay>000000</delay>
<day>1,2,3,4,5,6,7</day>
<loop>0</loop>
<cmd>#shutdown</cmd>
<cmdtype>0</cmdtype>
</job>
<job id="3">
<time>001000</time> <!-- run every 10 min with a 10 sec delay on startup -->
<delay>000010</delay>
<day>1,2,3,4,5,6,7</day>
<loop>1</loop>
<cmd>say -1 Annoying text that will repeate itself each 10 min</cmd>
<cmdtype>0</cmdtype>
</job>
<job id="4">
<time>000300</time> <!-- run once after 3 min -->
<delay>000000</delay>
<day>1,2,3,4,5,6,7</day>
<loop>0</loop>
<cmd>say -1 Bec has been now running for 3 min</cmd>
<cmdtype>0</cmdtype>
</job>
<!-- EXTERNAL COMMANDS -->
<job id="5">
<time>030000</time> <!-- run every 3 hour -->
<delay>000000</delay>
<day>1,2,3,4,5,6,7</day>
<loop>1</loop>
<cmd>C:\ServerTools\Bec\Config\test.bat</cmd>
<cmdtype>1</cmdtype>
</job>
</Scheduler>
Makes sense ???