使用windows內建任務計劃管理程式定時 調用Kettle作業

來源:互聯網
上載者:User

標籤:cer   style   指定   str   exp   電腦   建議   detail   參考   

系統平台:windows系統,其他動作系統請參考其他資料。

 

Kettle內建的定時任務調度不太穩定,而且必須開啟Kettle,可以通過windows的工作排程器調用Kettle的Kitchen.bat來實現定時作業。

網上找了一些Kitchen.bat的參數,也是一知半解,沒有深入研究。

kitchen.bat   後面可以是-也可以是/然後再加options

Options:
/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 =. 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.

而options 後面可以是=也可以是:也可以是空格

kitchen.bat /file d:\   或者 -file=D:\ 或者/file:D:\等等都可以。。。

下面正式開始建立調用方案

1:建立開機檔案,用於被windows工作排程器調用

  建立文字檔,重新命名為   "每日9點執行.bat",檔案右鍵編輯,以文字檔方式開啟,然後複製下面內容進去,儲存。

1 D:2 cd D:\pdi-ce-6.0.0.0-353\data-integration3 kitchen.bat -rep:XXX -dir:/ -job:"XXX" -user:XXX -pass:XXX -level:Basic -log:D:\kettlebat\log\每日9點執行%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt

 註:第一行D:到第三行的kitchen.bat為開啟Kettle的Kitchen.bat,該檔案一般在Kettle的根目錄,請根據實際儲存路徑修改。

-rep:後的XXX修改為資產庫名稱,-job:後的XXX修改為要執行的作業名稱,-user:和-pass:後的XXX為資產庫的帳號密碼,

-level為記錄層級,共有Basic, Detailed, Debug, Rowlevel, Error, Nothing六種層級,此處使用Basic,其它層級自行測試,

-log後為日誌儲存路徑,路徑中的%date和%time是在建立日誌的時候給日誌名添加上時間。

2:新增工作計劃
右鍵電腦或者我的電腦,選擇管理,選擇工作排程器。或者通過其他方式開啟,總之開啟工作排程器就對了。

點擊右側建立基本任務,輸入任務名稱,點擊下一步設定觸發器,點擊下一步設定具體的觸發條件,這裡可以設定成各種各樣的定時任務。

點擊下一步設定作業為啟動程式,然後選擇上面建立的  每日9點執行.bat,然後點擊完成即可。

上面為建立基本任務,設定比較簡單,功能比較弱,建議建立任務時直接點擊建立任務,指定更加可靠的任務,比如設定不管使用者是否登入都要運行、設定任務失敗後的重啟次數、設定任務的逾時時間等。

 

主要代碼來自於前輩翟大神,敬禮。

 


使用windows內建任務計劃管理程式定時 調用Kettle作業

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.