Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

external method

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


garry at schoolteachers

Jun 15, 2009, 1:40 PM

Post #1 of 7 (1017 views)
Permalink
external method

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
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


yourpadre at gmail

Jun 15, 2009, 6:19 PM

Post #2 of 7 (952 views)
Permalink
Re: external method [In reply to]

>
>
>
> Zope is running as user scholarpack who is an administrator on win
> server 2008.
> /
>
usar scholarpack have rights to access postgres?

are you see the logs from postgres? new conecctions?
or logs from zope?


chris at simplistix

Jun 16, 2009, 2:09 AM

Post #3 of 7 (953 views)
Permalink
Re: external method [In reply to]

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
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


garry at schoolteachers

Jun 16, 2009, 2:17 AM

Post #4 of 7 (951 views)
Permalink
Re: external method [In reply to]

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
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


chris at simplistix

Jun 16, 2009, 2:33 AM

Post #5 of 7 (949 views)
Permalink
Re: external method [In reply to]

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
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


garry at schoolteachers

Jun 16, 2009, 2:41 AM

Post #6 of 7 (951 views)
Permalink
Re: external method [In reply to]

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
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


garry at schoolteachers

Jun 16, 2009, 3:39 AM

Post #7 of 7 (951 views)
Permalink
Re: external method [In reply to]

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
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.