I have a system running over Tomcat which executes a backup batch job every day, it calls pg_dump.exe from Java and stores its output to an SQL file.
When I'm executing Tomcat from the shell, it works perfectly, but when I start Tomcat as a Windows service the pg_dump.exe process stays there doing nothing, the SQL file is never written and the dump is never performed.
Is there any additional parameter or configuration required for Windows services? because it works without problems on a Unix-box.
Update: I'm using a Java class to call the operation.
Process p = new ProcessBuilder(
"C:/postgres9/bin/pg_dump.exe",
"-U", "myuser",
"-h" , "localhost",
"mydb").start();
storeToFile( p.getInputStream() );
Specs:
- Tomcat 7.0.23
- Postgresql 9.1
- Windows 2008

pg_dump.exe? The parameters passed to it and possibly the caller environment would be interesting. From what you described so far, it can be anything (waiting for password is a usual suspect). – dezso Dec 10 '12 at 21:04