source: OpenWorkouts-current/bin/zeo_pack @ 5ec3a0b

currentfeature/docs
Last change on this file since 5ec3a0b was 5ec3a0b, checked in by borja <borja@…>, 5 years ago

Imported sources from the old python2-only repository:

  • Modified the code so it is python 3.6 compatible
  • Fixed deprecation warnings, pyramid 1.10.x supported now
  • Fixed deprecation warnings about some libraries, like pyramid-simpleform
  • Added pytest-pycodestyle and pytest-flakes for automatic checks on the source code files when running tests.
  • Added default pytest.ini setup to enforce some default parameters when running tests.
  • Cleaned up the code a bit, catched up with tests coverage.
  • Property mode set to 100644
File size: 933 bytes
Line 
1#!/bin/sh
2#
3# Script to pack the ZODB served by the ZEO server
4#
5# You have to set some values for the address, port, socket, days, etc
6# variables before running this script.
7#
8
9here=`dirname $0`
10address="localhost"
11port="8081"
12socket="${here}/../var/zeo/zeo.sock"
13days=7
14
15if [ -S ${socket} ]; then
16    echo "Found unix socket: ${socket}"
17    echo "Packing database"
18    # If the unix socket exists, pack the db connecting to ZEO using it
19    zeopack -d ${days} -U ${socket}
20    echo "Done"
21else
22    # check if there is a ZEO instance running in this address/port
23    nc -z ${address} ${port} > /dev/null
24    if [ $? == 0 ]; then
25        echo "Found running server (tcp): ${address}:${port}"
26        echo "Packing database"
27        # something is running there, try to pack the db
28        zeopack -d ${days} -h ${address} -p ${port}
29        echo "Done"
30    else
31        echo "Nor a valid unix socket neither an available tcp port could be"
32        echo "found, aborting"
33    fi
34fi
Note: See TracBrowser for help on using the repository browser.