postgresql - pgAgent scheduled job failed on Windows -
i trying set step batch file path on particular time in pgagent via pgadmin. when run failing , in step statistics got output
c:\windows\system32>c:\postgresql\run.bat 'psql' not recognized internal or external command, operable program or batch file.
details:
postgresql 9.3.5 on local system account (current user) pgadmin 1.18.1 pgagent via stack builder administrator account (current user) in run.bat have 2 statement
@echo off psql -h localhost -p 5433 -u postgres -d test -a -f "test.sql" i have psql in system path variable , able access in cmd. when run bat file manually executing without fail. when given batch file path (c:\postgresql\run.bat) in pgagent jobs giving error in statistics.
is there wrong in configuration? why going c:\windows\system32>?
edit:
my run.bat file
@echo off set lbsdatabasename=test set dbhost=localhost set dbport=5434 set dbuser=postgres set logfile=dbinstall.log set sqlfolder="d:\sourcecode\archivescripts" "c:\program files (x86)\postgresql\9.3\bin\psql.exe" -h "%dbhost%" -p "%dbport%" -d "%lbsdatabasename%" -u "%dbuser%" -l "%logfile%" -q -f "%sqlfolder%\archive.sql" my archive.sql
update "archive".emp set "firstname"='srikanth dyapa';
for example,
d:\pgagent_jobs
is path psql located.
d:\pgagent_jobs\scripts\test.sql
is path in test.sql placed.
d:\pgagent_jobs\scripts\psqlss.bat
is bat file execute test.sql
so bat file below
@echo off cd /d d:\\pgagent_jobs psql -h localhost -p 5432 -u postgres -d db_name -a -f "d:\pgagent_jobs\scripts\test.sql" note : pg_hba.conf configured trust hosts that's why not passing password in above psql command
Comments
Post a Comment