分类: Java
2009-02-26 10:23:21
Job Scheduler 学习笔记
一、安装
1、本文采用的是scheduler_win32.1.3.5,下载地址。
2、数据库采用的是oracle
3、安装时注意选择oracle,输入正确的oracle连接即可。
4、测试
二、使用说明
1、使用job schedule editor创建hot folder element ->job,然后将job存放到installpath/config/live下。(这种job不用重启job schedule server即可)
2、另外一种方法是编辑installpath/config/scheduler.xml文件。
三、例子
1、 Automatic Scheduled Execution of a Shell Script
This example job for the my_shell_script script is configured as follows:
* for an automatic start every 30 minutes (the job will be run 1800 seconds after the previous run has been completed), weekdays between 9 and 12 o'clock
* and for manual starts between 8:00 & 20:00 every day.
* The job starts the ./jobs/my_shell_script.sh shell script.
* Note that the scheduling can be combined with directory monitoring. This is described in Example 2 below.
The job is added to the ./config/scheduler.xml configuration file in the form of a job element as follows:
...
param = "">
end = "20:00">
2、Program Execution
In this example a MySQL database Windows Service will be restarted at 4:00 am by way of two jobs.
* The first service_stop job stops and the second service_start job starts the Windows service.
The Windows own net.exe program is used for both jobs.
This program lies in a sub-directory of the Windows system32 directory. The Windows %windir% enviroment variable can be used for this path.
Note that enviroment variables can also be designated on Windows systems using "$".
* The MySQL database service name is "MySQL". Additionally, jobs cannot be manually started.
* Note also that in this example it would actually be better to use a shell script, in order to catch errors.
The job is added to the ./config/scheduler.xml configuration file in the form of a job element as follows:
...
param = "stop MySQL">
param = "start MySQL">