From: yomguy Date: Sun, 3 Feb 2008 00:27:18 +0000 (+0000) Subject: Add checking functions X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=745ba040b2d4e1dad242bfdb99d0997763dd14e8;p=tools.git Add checking functions git-svn-id: http://svn.parisson.org/svn/tools/trunk@40 457c0346-1240-4656-8a5a-9edca8063506 --- diff --git a/python-zopebackup/zope_check.py b/python-zopebackup/zope_check.py new file mode 100755 index 0000000..f5b04b3 --- /dev/null +++ b/python-zopebackup/zope_check.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# +# Depends : zope_instance.py +# Copyright (C) 2007-2008 Guillaume Pellerin + +import os +import sys +from zope_instance import * + +version = '0.2' +info = 'zope_check v'+version+'\n'+ \ + """Copyright (C) 2007-2008 Guillaume Pellerin + Usage: zope_backup DIRECTORY + where DIRECTORY is the directory where you want to backup + the instances of the different versions of zope.""" + +#if len(sys.argv) < 2: +# sys.exit(info) +#else : +# backup_dir = sys.argv[1] + +z = ZopeInstall() +instances = z.get_instances() +instance_main_dir = z.instance_main_dir + +def get_zope_port(main_dir): + conf_path = main_dir + os.sep + 'etc' + os.sep + 'zope.conf' + conf = open(conf_path, 'r') + lines = conf.readlines() + for line in lines: + if 'HTTPPORT' in line: + return main_dir+': ' + line + +def check_all(): + for version in instances: + for instance in instances[version]: + z = ZopeInstance(version, instance) + print get_zope_port(z.get_instance_dir()) + +if __name__ == '__main__': + check_all() + + +