By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

job won't work on pgagent schedule

P: 51
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!
Nov 17 '10 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 700
just one line, echo ZZZ
You mean the job you define put string ZZZ on standard output?
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.).
Nov 18 '10 #2

P: 51
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.

Expand|Select|Wrap|Line Numbers
  1. set BACKUPDIR=D:\cij\works\backup\
  2. set PGHOST=localhost
  3. set PGUSER=quals
  4. set PGBIN=C:\Program Files (x86)\PostgreSQL\8.3\bin\
  5.  
  6. rem date format: dd/mm/yy
  7. for /f "tokens=1-3 delims=/ " %%i in ("%date%") do (
  8.  set day=%%i
  9.  set month=%%j
  10.  set year=%%k
  11. )
  12.  
  13. rem tiem format: hh:mm:ss
  14. for /f "tokens=1-3 delims=: " %%i in ("%time%") do (
  15.  set hh=%%i
  16.  set nn=%%j
  17. )
  18. echo %year% %month% %day% %hh% %mm%
  19.  
  20. "%PGBIN%pg_dumpall" -h %PGHOST% -p 5234 -U %PGUSER% -f "%BACKUPDIR%fullpgbackup-%year%%month%.sql"
  21. "%PGBIN%pg_dump" -i -h %PGHOST% -p 5234 -U %PGUSER% -F c -b -v -f "%BACKUPDIR%cijquals-%year%%month%%day%%hh%.compressed" cijquals
Nov 19 '10 #3

Expert 100+
P: 700
Put some debug log into this script (write some debug to log file) and check if there appear some logs when you call that job from pgagent
Nov 19 '10 #4

P: 51
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.

Expand|Select|Wrap|Line Numbers
  1. echo start here >t1.txt
  2. set BACKUPDIR=D:\cij\works\backup\
  3. set PGHOST=localhost
  4. set PGUSER=quals
  5. set PGBIN=C:\Program Files (x86)\PostgreSQL\8.3\bin\
  6.  
  7. rem date format: dd/mm/yy
  8. for /f "tokens=1-3 delims=/ " %%i in ("%date%") do (
  9.  set day=%%i
  10.  set month=%%j
  11.  set year=%%k
  12. )
  13. echo %year% %month% %day% >>t1.txt
  14. rem tiem format: hh:mm:ss
  15. for /f "tokens=1-3 delims=: " %%i in ("%time%") do (
  16.  set hh=%%i
  17.  set mm=%%j
  18. )
  19. echo  %hh% %mm% >>t1.txt
  20.  
  21. "%PGBIN%pg_dumpall" -h %PGHOST% -p 5234 -U %PGUSER% -f "%BACKUPDIR%fullpgbackup-%year%%month%.sql"
  22. "%PGBIN%pg_dump" -i -h %PGHOST% -p 5234 -U %PGUSER% -F c -b -v -f "%BACKUPDIR%cijquals-%year%%month%%day%%hh%.compressed" cijquals
Nov 22 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.