Pentaho

 View Only

 PROBLEM WITH GET MAILS with BATCH FILE in WINDOWS SERVER 2012 R2

  • Pentaho
  • Kettle
  • Pentaho
  • Pentaho Data Integration PDI
MOISES PEREZ CHAVEZ's profile image
MOISES PEREZ CHAVEZ posted 09-26-2019 10:43

Good Morning.

 

I am using this .bat to work with KITCHEN

call kitchen.bat /file:"E:\Desarrollo\Pentaho 8.2\KTR\SOPORTE\JOB-000-ImportacionActualizacion Prodlines-Variable.kjb" /level:Detailed > E:\RepProdlines_%date:~-4,4%%date:~-7,2%%date:~-10,2%_%time:~0,2%%time:~3,2%%time:~6,2%.log

 

and this is a part of the log file:

 

2019/09/26 11:23:29 - JOB-000-ImportacionActualizacion Prodlines-Variable - Starting entry [Lee Mail]

2019/09/26 11:23:29 - JOB-000-ImportacionActualizacion Prodlines-Variable - exec(2, 0, Lee Mail.0)

2019/09/26 11:23:29 - Lee Mail - Starting job entry

2019/09/26 11:23:29 - Lee Mail - New mail connection is defined.

2019/09/26 11:23:29 - Lee Mail - Connecting to host [imap.gmail.com] with username [xxxx@xxxxx.es] on port [993] ...

2019/09/26 11:23:30 - Lee Mail - Connected to host [imap.gmail.com] with username [xxxx@xxxxx.es] on port [993].

2019/09/26 11:23:31 - Lee Mail - Folder [INBOX] was opened.

2019/09/26 11:23:31 - Lee Mail - We found 37 messages in folder [INBOX] ...

2019/09/26 11:23:32 - Lee Mail - Attache file [prodline_without_family_201909260800.csv] for message number 144 was saved in folder [Q:\Product Setup\Extracciones].

2019/09/26 11:23:36 - Lee Mail - Attache file [prodline_without_family_201909261100.csv] for message number 170 was saved in folder [Q:\Product Setup\Extracciones].

2019/09/26 11:23:37 - Lee Mail - =======================================

2019/09/26 11:23:37 - Lee Mail - We successfully saved 0 message(s)

2019/09/26 11:23:37 - Lee Mail - 0 messages were deleted

2019/09/26 11:23:37 - Lee Mail - 0 messages were moved

2019/09/26 11:23:37 - Lee Mail - We successfully saved 2 attached file(s)

2019/09/26 11:23:37 - Lee Mail - =======================================

 

But when I used TASK SCHEDULER fails.

 

This is part of the log generated:

 

2019/09/26 12:16:32 - Lee Mail - Starting job entry

2019/09/26 12:16:32 - JOB-000-ImportacionActualizacion Prodlines-Variable - Finished job entry [Lee Mail] (result=[false])

2019/09/26 12:16:32 - JOB-000-ImportacionActualizacion Prodlines-Variable - Finished job entry [Get FECHA] (result=[false])

2019/09/26 12:16:32 - JOB-000-ImportacionActualizacion Prodlines-Variable - Job execution finished

2019/09/26 12:16:32 - Kitchen - Finished!

2019/09/26 12:16:32 - Kitchen - Start=2019/09/26 12:15:48.825, Stop=2019/09/26 12:16:32.346

2019/09/26 12:16:32 - Kitchen - Processing ended after 43 seconds.

 

I really do not know WHAT TO DO. I would really aprecciated any help.


#PentahoDataIntegrationPDI
#Pentaho
#Kettle
Dean Flinter's profile image
Dean Flinter

Does your job reference a file(s) on a network drive or is the job itself on a network drive? If so, then I had the same problem. Task Scheduler does not respect mapped network drives so you need to specify it in the bat file

 

Adding something like the below to your bat file should fix it

 

net use <drive letter>: \\<server>\<path to folder> /persistent:no

 

Make sure to use the same drive letter as your job

 

MOISES PEREZ CHAVEZ's profile image
MOISES PEREZ CHAVEZ

Hi Dean

 

Thanks for your answer. I tried including your suggestions and it worked when I prompt the .bat file, but I when I used scheduller fails.

 

.....

2019/10/02 17:14:29 - JOB-000-ImportacionActualizacion Prodlines-Variable - Finished job entry [Lee Mail] (result=[false])

2019/10/02 17:14:29 - JOB-000-ImportacionActualizacion Prodlines-Variable - Finished job entry [Get FECHA] (result=[false])

.....

 

 

Dean Flinter's profile image
Dean Flinter

Based on your original post, you are saving attachments down to Q:\Product Setup\Extracciones. Did you specify that drive location in your batch file (assuming it is a network drive)? Make sure to put it first in the script.

 

For example, in our organisation the shared drive is a folder on the server so it would be something like this

 

net use Q: \\Sharedserver\Shared /persistent:no

call kitchen.bat /file:"E:\Desarrollo\Pentaho 8.2\KTR\SOPORTE\JOB-000-ImportacionActualizacion Prodlines-Variable.kjb" /level:Detailed >

MOISES PEREZ CHAVEZ's profile image
MOISES PEREZ CHAVEZ

Sorry Dean, you were right,i did not remember I have that line

 

This is my bat, Q is my network drive and E my local server drive.

 

I did the changes as shown

 

  • net use q:\\esfs01\q /persistent:no
  • echo Este Archivo por lotes usará KITCHEN para sacar el Reporte de Prodlines
  • call kitchen.bat /file:"e:\Desarrollo\Pentaho 8.2\KTR\SOPORTE\JOB-000-ImportacionActualizacion Prodlines-Variable.kjb"

 

but nothing

Dean Flinter's profile image
Dean Flinter

Hi Moises

 

Assuming this is the issue, the only things I can think of are:

 

  1. Is the path correct? If you copy and paste that path in explorer, will it get you to the correct place?
  2. My .bat file has a space between the drive letter and server details so use q: \\esfs01\q instead of q:\\esfs01\q

 

Thanks

 

Dean

MOISES PEREZ CHAVEZ's profile image
MOISES PEREZ CHAVEZ

Dear Dean

 

Thank you much for your kind help.

I succesfully run my .bat file with task scheduller. You were right about the network drive, but it was my fault to add the incorrect name of the network drive.

 

This line solve my problem:

net use q: \\esfs01\groups$ /persistent:no

 

I really aprecciate your help.👏 👏 👍

 

Thanks

Moises

Dean Flinter's profile image
Dean Flinter

You're very welcome!

 

Glad you got it working. When I faced this issue it was very frustrating!!

Dean Flinter's profile image
Dean Flinter

I had a look back at when I had this issue and actually, the fix is simpler than the above. Just specify the UNC path in your job/transformation and it should work without having to edit the .bat file

 

The reason I needed to edit the .bat file was because I was reading data from an Excel file and the Excel input step does not support UNC paths, so I had to find another way

MOISES PEREZ CHAVEZ's profile image
MOISES PEREZ CHAVEZ

Morning Dean

 

Thanks for all help and I do not want to continue bothering.

I answered yesterday saying OK, when I forced to run to task. Today all my triggers failed and

gave me the same errors as original problem. In .bat I removed the net use.

Reading your last message, I changed my paths in all jobs/transformation but did not work in some steps.

This is a transformation in my job. This process is to read automatically the last file to import. GET FILE NAME reads UNC,

 

capture1

but then whe I passed to CSV INPUT, doesn't

Captura2

 

Dean Flinter's profile image
Dean Flinter

Hi Moises

 

Yeah, CSV input does not work with UNC.

 

Try Text File input as that does work with UNC

MOISES PEREZ CHAVEZ's profile image
MOISES PEREZ CHAVEZ

Good morning Dean

 

Finally I changed my line in .bat as shown:

net use q: \\esfs01\groups$

 

I supposed problems came because q is already mapped, but we still have to tell to Pentaho where is Q

 

Now is working without any problem, thanks for all your support.