windows and linux system kettle scheduled tasks

1、windows

windows定时任务bat文件

定时任务是kettle转换任务,使用pan命令,作业使用kitchen

Insert image description here
Create a new bat file:

// CHCP 936   -----GBK
CHCP 65001    ------utf-8
D:
cd D:\kettle\data-integration
pan /file E:\kkkkkkkkkkkkkk\t_forecast.ktr /level Basic /logfile E:\kkkkkkkkkkkkkk\forcast.log
@pause

Search for the program-task scheduler
Insert image description here

Insert image description here
2. Linux
In the Linux system, use commands to create new files. Remember to use commands as much as possible when operating the Linux system, otherwise there will be many strange errors.

1、创建文件夹
mkdir -p 文件夹名
2、创建文件
如:touch a.sh

Edit vi sh file:

#!/bin/bash
export JAVA_HOME=/usr/java/jdk1.8.0_144/
export JRE_HOME=${
    
    JAVA_HOME}/jre
export CLASSPATH=.:${
    
    JAVA_HOME}/lib:${
    
    JRE_HOME}/lib
export PATH=${
    
    JAVA_HOME}/bin:$PATH
currTime=$(date "+%Y-%m-%d")
panName="t_forecast-"
logName=$panName${
    
    currTime}.log
/usr/ldt/hs_eamil/data-integration/pan.sh -file=/usr/ldt/hs_eamil/kettleJobOrPan/t_forecast.ktr -level=Detailed -logfile=/usr/ldt/hs_eamil/kettleJobOrPan/log/$logName
添加可执行权限
chmod u+x a.sh
添加定时任务
crontab -e
//每天下午15点执行
0 15 * * * /usr/ldt/hs_eamil/kettleJobOrPan/a.sh

3. Problems encountered
1、检查数据库连接信息是否正确 2、sh脚本问题,虽然sh脚本看着和上面一样的,但重新录入一遍好了 3、脚本中file命令,(原因未知),在linux中运行了两个kettle,一个mysql抽取到mysql,使用的转换,没有问题,另外一个是mongodb转到mysql,也是转换,一直报以下错误,后查询有说file命令只能执行作业,后把这个转换放到作业中,再执行任务文件成功了!!!!Insert image description here

Guess you like

Origin blog.csdn.net/FORLOVEHUAN/article/details/108001611