Process is not running inside task scheduler

jmanzo20
jmanzo20 used Ask the Experts™
on
I have a batch file which name is "WatchDir.bat". The file is saved in c:\loadbo and it contains the following instruccions:

cd \loadbo
"C:\Program Files\Java\jdk1.7.0\bin\java"  WatchDir c:\loadbo\inFile

The program "WatchDir" is a java program which monitors a folder for new file creation. If a new file is created in c:\loadbo\infile, then a second batch file is executed (c:\loadbo\copyfile.bat)


If the program WatchDir.bat is run in console mode, everything works fine and I can see that the process continues running using taskmgr. The process keeps running because the java code is monitoring new file creation inside c:\loadbo\infile\.

The problem appears when I try to schedule the Watchdir.bat using task scheduler. Nothing happens, the process does not run even when the screen shows that the process is "executing". I have changing the frequency from executing at startup, execute each minute, etc. without success.

What may be happening?

My OS version windows server 2008 R2
JDK 7 for x64
CLASSPATH includes c:\loadbo
PATH includes c:\loadbo and "C:\Program Files\Java\jdk1.7.0\bin\"

Thank you for your help

Jorge Manzo



Process is not running inside task scheduler
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
When scheduling the task are you sure you are using an account that has enough privileges to run the task? For example does it require admin privs.

Also are you scheduling the tasking via command line or through the gui?
Brian PringleSystems Analyst II, SCM, ERP
Commented:
The task will initially run under the taskmgr.exe process.  Make sure that you set the task to run with elevated privileges and set a password.  Does that make a difference?  Do you see taskmgr.exe in Task Manager?  If not, check to make sure that the service is running.

Author

Commented:
Thank you.

The service for task mgr is running because I have other scheduled processes working fine.

I am using the GUI in order to schedule the task and I am using admin privileges and admin password. But, nothing changes.

In the GUI, I executed my process but if I try to see it running in taskmgr, it is not running.

One issue I did not mention; I have two Java JDK version on the same server, the JDK7 for x32 and JDK 7 for x64. But the batch file and path only make reference to JDK 7 x64 path.
I had this problem before. make sure you use the proper administrative account and password in scheduled tasks and right click it and test it my running it from the scheduled tasks gui.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial