Packing the Data.fs with wget fails since 2.9.7
Hi, This blog entry shows how to use wget to pack the zope database, which you can then put in a cronjob to call each day or week: http://blogs.translucentcode.org/mick/2004/03/10/using_wget_to_pack_zope/ It is just one line: wget -q http://username:password@YOURSITE.com:8080/Control_Panel/Database/manage_pac... But as a comment on that blog shows: this does not work anymore. Zope now requires that you visit that form using POST, which is not what wget is doing automatically. So you get an error in your event.log like this: 2007-06-13T18:43:41 ERROR Zope.SiteErrorLog http://localhost:9080/Control_Panel/Database/manage_pack Traceback (innermost last): Module ZPublisher.Publish, line 115, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 41, in call_object Module <string>, line 3, in _facade Module AccessControl.requestmethod, line 52, in _curried Forbidden: Request must be POST I have tried adding POST data to the wget call. Then you get this and other variations: wget -q --post-data='days:float=1&submit=Pack' \ http://user:password@localhost:8080/Control_Panel/Database/manage_pack But that gives other errors: Unauthorized: Your user account does not have the required permission. Access to 'title_or_id' of (DatabaseChooser at /Control_Panel/Database) denied. Your user account, Anonymous User, exists at (unknown). Access requires one of the following roles: ['Manager']. Your roles in this context are ['Anonymous']. For zeo I could use the bin/zeopack.py from the zope software home, but not for non-zeo zope servers. Does anybody know a solution? -- Maurits van Rees | http://maurits.vanrees.org/ [NL] Work | http://zestsoftware.nl/ "Do not worry about your difficulties in computers, I can assure you mine are still greater."
--On 14. Juni 2007 09:35:17 +0000 Maurits van Rees <m.van.rees@zestsoftware.nl> wrote:
Hi,
This blog entry shows how to use wget to pack the zope database, which you can then put in a cronjob to call each day or week:
Write a PythonScript within the ZMI that calls the pack operation. Then call *this* script through wget. -aj
Andreas Jung, on 2007-06-14:
Write a PythonScript within the ZMI that calls the pack operation. Then call *this* script through wget.
I have found an alternative with urllib2. I added it to instancemanager. For those interested, see this changeset: http://dev.plone.org/collective/changeset/43815 Basically it is this: import urllib2 import base64 # Create a request req = urllib2.Request(url="http://localhost:8080/Control_Panel/ Database/manage_pack?days:float=7") # Add an authorization header auth = base64.encodestring("user:password") req.add_header('Authorization', "Basic %s" % auth) # Use POST instead of GET: needed at least in Zope 2.9.7 req.add_data('POST') info = urllib2.urlopen(req) -- Maurits van Rees | http://maurits.vanrees.org/ [NL] Work | http://zestsoftware.nl/ "Do not worry about your difficulties in computers, I can assure you mine are still greater."
participants (2)
-
Andreas Jung -
Maurits van Rees