Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Schedule .KTR (Pentaho-Spoon) Files through Windows Task Scheduler

  1. #1
    Join Date
    Aug 2017
    Posts
    19

    Default Schedule .KTR (Pentaho-Spoon) Files through Windows Task Scheduler

    I need to Schedule .KTR (Pentaho-Spoon) Files through Windows Task Scheduler as We don't have any java embedded application .
    I need to schedule my .KTR file in Mid-night. I wrote the Script but isn't working.Here My Spoon folder is in D Drive and "D:\Spoon\Stable\data-integration\kitchen.sh this is my SPOON Location"

    I need to Schedule .KTR (Pentaho-Spoon) Files through Windows Task Scheduler as We don't have any java embedded application .
    I need to schedule my .KTR file in Mid-night. I wrote the Script but isn't working.Here My Spoon folder is in D Drive and "D:\Spoon\Stable\data-integration\kitchen.sh this is my SPOON Location"


    Please correct the script for me so that I can schedule the task easily
    This is the script I saved as Schedule.bat ----

    D:\Spoon\Stable\data-integration\kitchen.sh \pan.bat /file=
    D:\Spoon\Stable\data-integration\kitchen.sh \Mid12.ktr /log=D:\Spoon\Stable\data-integration\kitchen.sh \logs\myTransfo.log

  2. #2
    Join Date
    Jun 2016
    Posts
    107

    Default

    Hi Bilalk,

    If you want to run kettle transformation through batch file in windows environment , you have to use pan.bat.
    Kitchen.bat is used for job in windows environment and .sh is used in Linux environment.

    please check the below syntax.

    cd kettle_path
    pan.bat /rep:repository_name /trans:transformation_name /logfile : logfile_path

    eg:
    cd E:/Softwares/data-integration
    pan.bat /rep:POC /trans:read_csv_file

    Thank you,
    Janu
    Last edited by Jahnavi; 11-15-2017 at 06:21 AM.

  3. #3
    Join Date
    Sep 2014
    Posts
    8

    Default

    Hi Bilalk,


    For running transformation through batch file in windows environment ,you need to use "pan.bat" , Kitchen.sh we use when we want to run Job in Linux environment.
    I am not able to access batch file provided by you, so providing a code for it .


    @ECHO off
    SET path=%~dp0..\..\..\..\ThirdParty\Python27-64;%~dp0..\..\..\..\ThirdParty\Python27-64\Scripts;%PATH%
    @echo--- setting parameters as per etl
    SET EDATE=%1
    SET FDATE=%2


    IF %EDATE% == '' GOTO :COOKIEERROR
    IF %FDATE% == '' GOTO :COOKIEERROR
    GOTO :START


    :COOKIEERROR
    echo ERROR : One of the Expected Values has not been passed as a parameter.
    GOTO :END


    :START
    pushd %~dp0


    @call pushd ..\..\..\..\ThirdParty\ETL\data-integration
    call pan.bat /level:Basic /filegive your full transformation path here and remove text).ktr "-param:END_DT=%EDATE%" "-param:FileDate=%FDATE%"


    popd %~dp0


    save this code as .bat
    Create task--> in windows task scheduler,
    Trigger section--> set the frequency ,
    Finish section --> call this Batch file ,in Add arguments --> pass same arguments called in .bat

    Thanks ,
    Payal

  4. #4
    Join Date
    Aug 2017
    Posts
    19

    Default

    Hi I wrote this but a black window is coming and going in within a second.

    @ECHO off
    SET path=%~dp0..\..\..\..\ThirdParty\Python27-64;%~dp0..\..\..\..\ThirdParty\Python27-64\Scripts;%PATH%
    @echo--- setting parameters as per etl
    SET EDATE=%1
    SET FDATE=%2




    IF %EDATE% == '' GOTO :COOKIEERROR
    IF %FDATE% == '' GOTO :COOKIEERROR
    GOTO :START




    :COOKIEERROR
    echo ERROR : One of the Expected Values has not been passed as a parameter.
    GOTO :END




    :START
    pushd %~dp0




    @call pushd ..\..\..\..\ThirdParty\ETL\data-integration
    call pan.bat /level:Basic /D:\PDI SPOON\data-integration\exed).ktr "-param:END_DT=%EDATE%" "-param:FileDate=%FDATE%"




    popd %~dp0

  5. #5
    Join Date
    Aug 2017
    Posts
    19

    Default

    Hi Jhanavi,
    A script is running but error ..this is the script i wrote

    cd E:/Softwares/data-integration
    pan.bat /rep:POC /trans:exed.ktr ............. where exed is my KTR name

  6. #6
    Join Date
    Jun 2016
    Posts
    107

    Default

    Hi Bilalk,

    In my example POC is the repository name and "E:/Softwares/data-integration" is the path of spoon.bat file location.if you don't have a repository , you can try with the following syntax.

    cd spoon.bat file path
    pan.bat /file:"transformation path"

    cd E:/Softwares/data-integration
    pan.bat /file:"F:\POC\read_csv_file.ktr"

    Thank you,
    Janu

  7. #7
    Join Date
    Aug 2017
    Posts
    19

    Default

    cd D:\PDI SPOON\data-integration
    pan.bat /file:"D:\PDI SPOON\data-integration\exed.ktr"

    here exed is my ktr name ,,when i am ruuning that bat file and a window coming for 1 sec and going,,showing some internal type error ...
    Is this script wrong ??

  8. #8
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Create a new batch file (for example RunMe.bat) with the following as contents.=
    Code:
    cd /d D:\PDI SPOON\data-integration
    pan.bat "/file:D:\PDI SPOON\data-integration\exed.ktr" > runlog.txt
    Now try running it. A blank window should pop up and disappear not long after.
    In your D:\PDI SPOON\data-integration directory, there will now be a runlog.txt
    Post it here.

  9. #9
    Join Date
    Jun 2016
    Posts
    107

    Default

    Hi,

    You cab try with the following syntax, first you have to open cmd prompt and go to .bat file location path then run it.Once this file runs successfully then you can schedule this batch file in your windows environment through task scheduler.

    cd D:/PDI SPOON/data-integration
    pan.bat /file:"D:\PDI SPOON\data-integration\exed.ktr"

    Quote Originally Posted by Bilalk View Post
    cd D:\PDI SPOON\data-integration
    pan.bat /file:"D:\PDI SPOON\data-integration\exed.ktr"

    here exed is my ktr name ,,when i am ruuning that bat file and a window coming for 1 sec and going,,showing some internal type error ...
    Is this script wrong ??
    Last edited by Jahnavi; 11-16-2017 at 02:10 AM.

  10. #10
    Join Date
    Aug 2017
    Posts
    19

    Default

    DOne Gutlez..It's working ,thanks to ever one here

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.