Showing posts with label CMD. Show all posts
Showing posts with label CMD. Show all posts

June 2, 2013

Pentaho Data Integration - Run from the Windows cmd (#018)

Run a transformation from the Windows cmd
Run a transformation from the Windows command line
Run a transformation from shell
Run a job from the Windows cmd
Run a job from the Windows command line
Run a job from shell

Running a transformation

To run a job from the cmd you need to use the "Pan" batch file. The script is located in the main Pantaho folder.


Create the "execute_from_cmd" folder in the "Repository explorer."


Create a dummy transformation.






Create a dummy job.





Run the job to test it.



The information needed to run the transformation can be found in the "Repository Connection" window.


To get the details edit the repository.


The Information how to run a Pentaho process can be found on the Pentaho Wiki pages:
http://wiki.pentaho.com/display/EAI/Pan+User+Documentation


Run the dummy transformation:

Pan.bat /rep:penrep_id /user:admin /pass:admin /dir:/execute_from_cmd /trans:tr_dummy /level:Detailed

/rep:   - a repository
/user:  - the repository user name
/user:  - the repository password
/dir:   - the repository directory
/trans: - the repository transformation to run
/level: - logging level



To write the results to the log file use the "/log" clause:

Pan.bat /rep:penrep_id /user:admin /pass:admin /dir:/execute_from_cmd /trans:tr_dummy /level:Detailed /log:C:\a_example_log_file.log

/rep:   - a repository
/user:  - the repository user name
/user:  - the repository password
/dir:   - the repository directory
/trans: - the repository transformation to run
/level: - logging level
/log:   - the logging file




Running a job

To run the job from the cmd you need to use the "Kitchen" batch file. The script is located in the main Pantaho folder.



The Information how to run the a Pentaho job can be found on the Pentaho Wiki pages:

or the Infocenter pages:
http://infocenter.pentaho.com/help/index.jsp?topic=%2Fpdi_user_guide%2Freference_kitchen.html


Run the dummy job:

Kitchen.bat /rep:penrep_id /user:admin /pass:admin /dir:/execute_from_cmd /job:jb_dummy /level:Basic



This time to write the results to the log file redirect the output

Kitchen.bat /rep:penrep_id /user:admin /pass:admin /dir:/execute_from_cmd /job:jb_dummy /level:Basic > C:\a_example_log_file.log




January 23, 2013

Windows CMD - Useful (#005)

Count lines in multiple files using Windows command prompt

for %G in (*.sql) do find /c /v "~~~" %G

Source: http://ora-00001.blogspot.ca/2011/07/count-lines-in-multiple-files-using.html






Add date and time to log files created from Windows command prompt

:: change window's title
TITLE date_in_a_file_name

:: print current date and time
ECHO current_date: %date%
ECHO current_time: %time%

@echo off
:: format of date is YYYYMMDD
SET currdate=%date%
SET dd=%currdate:~7,2%
SET mm=%currdate:~4,2%
SET yyyy=%currdate:~10,4%
SET yyyymmdd=%yyyy%%mm%%dd%

:: format of time is HHMiSS
SET currtime=%time%
SET hh=%currtime:~0,2%
SET mi=%currtime:~3,2%
SET ss=%currtime:~6,2%
SET hhmiss=%hh%%mi%%ss%
SET hhmiss=%hhmiss: =%

ECHO test_string > C:\result_file_with_a_date_%yyyymmdd%_%hhmiss%.log