# Import from the Standard Library from optparse import OptionParser # Import from itools import itools # Import from ikaaro from ikaaro.server import Server if __name__ == '__main__': # The command line parser usage = '%prog TARGET [TARGET]*' version = 'itools %s' % itools.__version__ description = ('Stops the web server that is publishing the TARGET' ' ikaaro instance (if it is running). Accepts' ' several TARGETs at once, to stop several servers.') parser = OptionParser(usage, version=version, description=description) parser.add_option('--force', action="store_true", default=False, help="Emits SIGTERM instead of SIGINT signal.") options, args = parser.parse_args() if len(args) == 0: parser.error('incorrect number of arguments') # Action! for target in args: server = Server(target) server.stop(force=options.force)
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Import from standard library from pprint import pprint # Import from ikaaro from ikaaro.server import Server, create_server path = 'www.hforge.org' email = '*****@*****.**' password = '******' root = None modules = [] listen_port = 8081 create_server(path, email, password, root, modules, listen_port) server = Server(path) server.start(detach=False, loop=False) print('Launch reindexation') reindex_success = server.reindex_catalog(quiet=True) if reindex_success: print('Reindex was successfull') else: print('Error in reindexation') retour = server.do_request('GET', '/;_ctrl') pprint(retour) server.stop()