Skip to content

Commit

Permalink
- remove broken and terrible advice involving URL-whacking the ZMI
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed May 13, 2019
1 parent 7eda8f8 commit ca6c85b
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions docs/zopebook/MaintainingZope.rst
Original file line number Diff line number Diff line change
Expand Up @@ -607,59 +607,6 @@ manually by opening Zopes Control_Panel and clicking on the "Database
Management" link. Zope offers you the option of removing only object version
older than an adjustable amount of days.

If you want to automatically pack the ZODB you could tickle the appropriate URL
with a small python script (the traditional filesystem based kind, not Zopes
"Script (Python)")::

#!/usr/bin/python
import sys, urllib
host = sys.argv[1]
days = sys.argv[2]
url = "%s/Control_Panel/Database/manage_pack?days:float=%s" % (host, days)
try:
f = urllib.urlopen(url).read()
except IOError:
print "Cannot open URL %s, aborting" % url
print "Successfully packed ZODB on host %s" % host

The script takes two arguments, the URL of your server (eg.
http://mymachine.com) and the number of days old an object version has to be to
get discarded.

On Unix, put this in eg. the file::

/usr/local/sbin/zope_pack

and make it executable with::

chmod +x zope_pack

Then you can put in into your crontab with eg.::

5 4 * * sun /usr/local/sbin/zope_pack http://localhost 7

This would instruct your system to pack the ZODB on 4:05 every sunday. It would
connect to the local machine, and leave object versions younger than 7 days in
the ZODB.

Under Windows, you should use the scheduler to periodically start the script.
Put the above script in eg.::

c:\Program Files\zope_pack.py

or whereever you keep custom scripts, and create a batch file::

zope_pack.bat

with contents similar to the following:::

"C:\Program Files\zope\bin\python.exe" "C:\Program Files\zope_pack.py" "http://localhost" 7

The first parameter to python is the path to the python script we just created.
The second is the root URL of the machine you want to pack, and the third is
the maximum age of object versions you want to keep. Now instruct the scheduler
to run this `.bat` file every week.

Zope backup is quite straightforward. If you are using the default storage
(FileStorage), all you need to do is to save the file::

Expand Down

0 comments on commit ca6c85b

Please sign in to comment.