I installed pgagent in a windows 7. On pgadmin3, I can see JOB. And I create a simple Job on it to run a simple batch file, just one line, echo ZZZ. I try to "run now". it won't work at all. I check pgAgent service, it's running. And run by a PC account who can access the batch file. Just don't what else I have missed out!
job won't work on pgagent schedule
Collapse
X
-
You mean the job you define put string ZZZ on standard output?just one line, echo ZZZ
You want postgres job write some where?, on the terminal? What for?
It is not what the job was "invented" for. Job usually do some database things (puit data into tables, update some data etc.). -
I have a script to run pg_dumpall and pg_dump modified from pgAgent installation document. It won't work at all. That why I try a simple script just echo something to see if it works. The script is as the following. It works when I run it on command windows.
Code:set BACKUPDIR=D:\cij\works\backup\ set PGHOST=localhost set PGUSER=quals set PGBIN=C:\Program Files (x86)\PostgreSQL\8.3\bin\ rem date format: dd/mm/yy for /f "tokens=1-3 delims=/ " %%i in ("%date%") do ( set day=%%i set month=%%j set year=%%k ) rem tiem format: hh:mm:ss for /f "tokens=1-3 delims=: " %%i in ("%time%") do ( set hh=%%i set nn=%%j ) echo %year% %month% %day% %hh% %mm% "%PGBIN%pg_dumpall" -h %PGHOST% -p 5234 -U %PGUSER% -f "%BACKUPDIR%fullpgbackup-%year%%month%.sql" "%PGBIN%pg_dump" -i -h %PGHOST% -p 5234 -U %PGUSER% -F c -b -v -f "%BACKUPDIR%cijquals-%year%%month%%day%%hh%.compressed" cijqualsComment
-
Thank you, rski. I changed my scripts as followings which has some point to output log on a text file, t1.txt. I run it from command window with the same login user as pgAgent service. It works and t1.txt is output correctly. While on pgAgent, I click 'Run now'. there is just nothing happened. And no output log as well. I check the statistic, there is no any entry on it. It seems pgAgent didn't run it at all.
Code:echo start here >t1.txt set BACKUPDIR=D:\cij\works\backup\ set PGHOST=localhost set PGUSER=quals set PGBIN=C:\Program Files (x86)\PostgreSQL\8.3\bin\ rem date format: dd/mm/yy for /f "tokens=1-3 delims=/ " %%i in ("%date%") do ( set day=%%i set month=%%j set year=%%k ) echo %year% %month% %day% >>t1.txt rem tiem format: hh:mm:ss for /f "tokens=1-3 delims=: " %%i in ("%time%") do ( set hh=%%i set mm=%%j ) echo %hh% %mm% >>t1.txt "%PGBIN%pg_dumpall" -h %PGHOST% -p 5234 -U %PGUSER% -f "%BACKUPDIR%fullpgbackup-%year%%month%.sql" "%PGBIN%pg_dump" -i -h %PGHOST% -p 5234 -U %PGUSER% -F c -b -v -f "%BACKUPDIR%cijquals-%year%%month%%day%%hh%.compressed" cijqualsComment
Comment