Hello -

I'm relatively new to the postgresql world - primarily using it to load up a 
backup of our hosted Jive community databases (which use postgresql).

To that end, we've created and scheduled a batch file (yes, we're using a 
windows server...) to download the backups (*.dmp files) from the hosted 
service and reload our local databases each night.

The process appears to work fine (i.e., the databases are loaded as expected), 
but every day there is another lingering instance of "createdb.exe" in the task 
manager.  This does not appear to happen when I run the batch file manually 
from the command line - only when it runs as a scheduled task.

Here's a trimmed down version of the batch file - it's relatively simplistic at 
this point.  Has anyone run into this issue, or have any suggestions for where 
to start...?



rem Remove previously downloaded backup files
del *.dmp

rem Use wget to download 2 backup files
"C:\Program Files\WinWget\wget\wget.exe" --http-user=%USER% 
--http-passwd=%PASS% "%ANALYTICS_DATABASE%.dmp"
"C:\Program Files\WinWget\wget\wget.exe" --http-user=%USER% 
--http-passwd=%PASS% "%FULL_BACKUP%.dmp"

rem Restart the windows service to ensure no connected users - otherwise dropdb 
will fail
net stop postgresql-8.4
net start postgresql-8.4

rem Drop existing databases
"c:\Program Files\PostgreSQL\8.4\bin\dropdb.exe" -U postgres -w jive_analytics
"c:\Program Files\PostgreSQL\8.4\bin\dropdb.exe" -U postgres -w jive_full

rem Recreate Analytics database
"c:\Program Files\PostgreSQL\8.4\bin\createdb" -U postgres jive_analytics
"c:\Program Files\PostgreSQL\8.4\bin\pg_restore" -U postgres -O -d 
jive_analytics "%ANALYTICS_DATABASE_FILE%.dmp"

rem Recreate Analytics database
"c:\Program Files\PostgreSQL\8.4\bin\createdb" -U postgres jive_full
"c:\Program Files\PostgreSQL\8.4\bin\pg_restore" -U postgres -O -d jive_full 
"%FULL_BACKUP_FILE%.dmp"

rem Grant access to all tables to jive_local user for both databases
"c:\Program Files\PostgreSQL\8.4\bin\psql.exe" -U postgres -d jive_full -qAt -c 
"select 'grant select on ' || tablename || ' to jive_local;' from pg_tables 
where schemaname = 'public'" | "c:\Program Files\PostgreSQL\8.4\bin\psql.exe" 
-U postgres -d jive_full

"c:\Program Files\PostgreSQL\8.4\bin\psql.exe" -U postgres -d jive_analytics 
-qAt -c "select 'grant select on ' || tablename || ' to jive_local;' from 
pg_tables where schemaname = 'public'" | "c:\Program 
Files\PostgreSQL\8.4\bin\psql.exe" -U postgres -d jive_analytics

Reply via email to