WatchDirectory Forum
watchDirectory forums >> Plugins >> No output from batch file or vbscript

Message started by joethompson on Mar 2nd, 2011 at 4:12pm

Title: No output from batch file or vbscript
Post by joethompson on Mar 2nd, 2011 at 4:12pm
Hi, I'm hoping someone can help me as I'm banging my head against the desk with this one!!

I'm using the batch file plugin to launch a batch file when a file lands in a specific folder. The batch file performs several tasks:

1. Write the name of the newly arrived file (using the WD_FILE variable) to a log file.
2. Send the file to an external client using command-line cURL to send the file via FTP(S)
3. Move the sent file to an archive folder and output the result of the move to the log file.

Task 2 has a switch in which should create a trace log file which we can then use for future troubleshooting should a file not be sent correctly.

When I run the batch file outside of watchDirectory it performs exactly as intended, producing the required logs at each step along the way. When it's launched by watchDirectory though I only get the logging from stages 1 and 3, with the trace log failing to be created completely.

I've tried configuring the job to capture the output from the batch file in case this was where it was failing, but this seemingly captures no output at all. I've also tried converting the batch file into vbs and launching the cURL command from here with no better results.

The job is running as a windows service under a local user account configured on the server.

Does anyone have any ideas why watchDirectory may be blocking the output of the trace log and no other part of this batch file and / or how to fix it??

Any and all help gratefully received !!!  :-/

Title: Re: No output from batch file or vbscript
Post by Gert on Mar 3rd, 2011 at 6:55am
Hello Joe,

Make sure to read

What I think may be happening is your logfile is created in the "current directory". Tasks that run as a Service have "C:\Windows\System32" as the current directory (I think). It may help if you start your batch script with

CD \Temp

Hope this helps.

Title: Re: No output from batch file or vbscript
Post by joethompson on Mar 3rd, 2011 at 1:40pm
Hi Gert,

Thanks for your help. In the end it was a permissions issue...

Running the script in manual mode (ie under my admin account) worked fine but running it under the service account I had designated for it generated the same fault - some logging worked but the trace log failed.

After a lot of testing I discovered that the service account I had set up didn't have read permissions on the cURL program folder and so was unable to run the file transfer command, hence no trace log was being generated as there was nothing to trace!! Doh!

Now all the permissions are configured correctly, the batch file is running exactly as intended.  ::)

Many thanks,

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2018. All Rights Reserved.