I have the following external method to back up a postgres database, using the following software versions. Zope Version (Zope 2.9.0, python 2.4.2, win32) Python Version 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] System Platform win32 Zope is running as user scholarpack who is an administrator on win server 2008. / import subprocess def backup(): try: p=subprocess.Popen("c:/scholarpack/postgres/bin/pg_dump scholarpack",shell=True,stdout=subprocess.PIPE) data=p.communicate()[0] f=open('c:/scholarpack/ancillary/scholarpack.sql','w') w=f.write(data) f.close() except OSError: print "There was a problem opening the file for writing" /When I run this through Zope I get an empty file. There are no errors reported. However, if I use the same python that is running zope in an interactive shell and run these commands then it works as expected. Can anyone spot what I am obviously missing? Regards Garry
Garry Saddington wrote:
I have the following external method to back up a postgres database, using the following software versions.
Why on earth would you not just do this in a cron job?! Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote:
Garry Saddington wrote:
I have the following external method to back up a postgres database, using the following software versions.
Why on earth would you not just do this in a cron job?!
Chris
Because I want the backup to be done manually, through the web from anywhere. Regards Garry
Garry Saddington wrote:
Because I want the backup to be done manually,
That doesn't seem like such a hot idea. Something that's easilly forgotten. Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote:
Garry Saddington wrote:
Because I want the backup to be done manually,
That doesn't seem like such a hot idea. Something that's easilly forgotten. Yes I know. It will be a utility function that will be extra to the normal cron way to back up. This works perfectly on Linux and I have found the method useful to quickly get a copy of the data to use at home off line. However, I need to get it working on windows. Regards Garry
Garry Saddington wrote:
Chris Withers wrote:
Garry Saddington wrote:
Because I want the backup to be done manually,
That doesn't seem like such a hot idea. Something that's easilly forgotten.
Thanks, I've sorted it. Turns out that pg_dump was being run by SYSTEM and not by the Zope effective user as I thought. Changed the command to include -U scholarpack and all works fine. Thanks for help. Regards Garry
participants (3)
-
Chris Withers -
Garry Saddington -
Miguel Beltran R.