Hitachi Vantara Pentaho Community Forums
Results 1 to 14 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

  11. #11
    Join Date
    Sep 2014
    Posts
    8

    Default

    Hi Bilalk,

    You don't need to run that bat file ,Just call it from scheduler or if you want to check then access the path of bat file on cmd , pas the arguments and run .If it give you correct result on cmd , it should work on Task scheduler.

  12. #12
    Join Date
    Aug 2017
    Posts
    19

    Default

    Gutlez ,,I am able to run the file when I am manually running bu t same file i am selecting it in Program/script window and browsing the path for that RunMe.bat file in windows task scheduler that is not working.

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

    Default

    What does the runlog.txt say?
    That will usually tell you what's going on.

    Also remember that Windows Scheduler doesn't have the same drive mappings and environment variables that your interactive user account has, so you may have to set some things up at the beginning of your RunMe.bat

  14. #14
    Join Date
    Aug 2016
    Posts
    142

    Default

    I have found that for particular folders (for me it was desktop) you need to add the path to the folder where the bat file is located to the "Start In (optional)" box in the Actions tab of the task.

    Oddly I don't have to do that for bat files in My Documents but it is worth trying

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.