原文: http://www.voidcn.com/article/p-fsovpgez-bqn.html
转发如下:
本周项目上用到了kettle并且需要做任务调度,听老师说用kettle自带的调度不大稳定于是便baidu了下,参照这篇文章完成了通过kitchen的调度,简单说就是通过windows的计划任务来调用.bat的批处理文件来开始kettle作业。
Span——转换(trasform)执行器 (命令行方式)
/rep : Repository name
/user : Repository username
/pass : Repository password
/job : The name of the job to launch
/dir : The directory (dont forget the leading /)
/file : The filename (Job XML) to launch
/level : The logging level (Basic, Detailed, Debug, Rowlevel, Error, Nothing)
/logfile : The logging file to write to
/listdir : List the directories in the repository
/listjobs : List the jobs in the specified directory
/listrep : List the available repositories
/norep : Do not log into the repository
/version : show the version, revision and build date
/param : Set a named parameter <NAME>=<VALUE>. For example -param:FOO=bar
/listparam : List information concerning the defined parameters in the specified job.
/export : Exports all linked resources of the specified job. The argument is the name of a ZIP
file.
kitchen.bat /norep -file=D:/kettledata/mysal2orcle.kjb >> kitchen_%date:~0,10%.log
exit
./kitchen.sh -file=/home/etl/mysql.kjb >> /home/etl/log/kettle.log
有一篇介绍
-rep : Repository name 任务包所在存储名
-user : Repository username 执行人
-pass : Repository password 执行人密码
-job : The name of the job to launch 任务包名称
-dir : The directory (don''t forget the leading / or \)
-file : The filename (Job XML) to launch
-level : The logging level (Basic, Detailed, Debug, Rowlevel, Error, Nothing) 指定日志级别
-log : The logging file to write to 指定日志文件
-listdir : List the directories in the repository 列出指定存储中的目录结构。
-listjobs : List the jobs in the specified directory 列出指定目录下的所有任务
-listrep : List the defined repositories 列出所有的存储
-norep : Don''t log into the repository 不写日志
嗯,居然不支持调度。看了一下文档,建议使用操作系统提供的调度器来实现调度,比如:Windows可以使用它的任务计划工具。
date的用法
D:\>date /T
2010-12-10 星期五
D:\>echo %date:~0,10%
2010-12-10
date:命令(别忘记date后面有个冒号)
~0:从索引0开始取内容
,10:取10个字符
注:也就是从”2010-12-10 星期五“从索引0开始,往后取10个字符,正好是”2010-12-10“,8个数字,2个”-“横线。
time用法:和date用法类似,把上面的date替换成time即可
常见用法:
1、每天创建以日期命名的文件
D:\>copy nul %date:~0,10%.log
已复制 1 个文件。
于是D盘下出现名为2010-12-10.log的文件。
2、每天创建以日期以及小时命名的文件
D:\>set filename="%date:~0,10% %time:~0,2%-%time:~3,2%.log"
D:\>copy nul %filename%
已复制 1 个文件。
D盘下出现2010-12-10 22-22.log。