diff --git a/functions.sh b/functions.sh deleted file mode 100644 index aab8e0f8..00000000 --- a/functions.sh +++ /dev/null @@ -1,4 +0,0 @@ -function check_port(){ - netstat -an 2>/dev/null | grep -q "$1" - return $? -} diff --git a/setup-memcached-env.sh b/setup-memcached-env.sh index 4fb5cc2b..b71c7a05 100755 --- a/setup-memcached-env.sh +++ b/setup-memcached-env.sh @@ -1,8 +1,6 @@ #!/bin/bash set -x -e -. functions.sh - function clean_exit(){ local error_code="$?" local spawned=$(jobs -p) @@ -14,16 +12,11 @@ function clean_exit(){ trap "clean_exit" EXIT -if ! check_port 11211; then - memcached_bin=$(which memcached || true) - if [ -n "$memcached_bin" ]; then - $memcached_bin & - else - echo "Memcached server not available" - exit 1 - fi +memcached_bin=$(which memcached || true) +if [ -n "$memcached_bin" ]; then + $memcached_bin -p 11212 & fi -export TOOZ_TEST_MEMCACHED_URL="memcached://?timeout=5" +export TOOZ_TEST_MEMCACHED_URL="memcached://localhost:11212?timeout=5" # Yield execution to venv command $* diff --git a/setup-mysql-env.sh b/setup-mysql-env.sh index 2a8b9bf6..6262e301 100755 --- a/setup-mysql-env.sh +++ b/setup-mysql-env.sh @@ -1,8 +1,6 @@ #!/bin/bash set -x -e -. functions.sh - clean_exit () { local error_code="$?" kill $(jobs -p) diff --git a/setup-postgresql-env.sh b/setup-postgresql-env.sh index 463597a8..b860748a 100755 --- a/setup-postgresql-env.sh +++ b/setup-postgresql-env.sh @@ -1,8 +1,6 @@ #!/bin/bash set -x -e -. functions.sh - function clean_exit() { local error_code="$?" ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-p $PGSQL_PORT" stop diff --git a/setup-redis-env.sh b/setup-redis-env.sh index 1681f099..fe068da7 100755 --- a/setup-redis-env.sh +++ b/setup-redis-env.sh @@ -1,8 +1,6 @@ #!/bin/bash set -x -e -. functions.sh - function clean_exit(){ local error_code="$?" local spawned=$(jobs -p) @@ -14,16 +12,11 @@ function clean_exit(){ trap "clean_exit" EXIT -if ! check_port 6379; then - redis_bin=$(which redis-server || true) - if [ -n "$redis_bin" ]; then - $redis_bin --port 6379 & - else - echo "Redis server not available" - exit 1 - fi +redis_bin=$(which redis-server || true) +if [ -n "$redis_bin" ]; then + $redis_bin --port 6380 & fi -export TOOZ_TEST_REDIS_URL="redis://localhost:6379?timeout=5" +export TOOZ_TEST_REDIS_URL="redis://localhost:6380?timeout=5" # Yield execution to venv command $* diff --git a/setup-zookeeper-env.sh b/setup-zookeeper-env.sh index 5bd35219..8e60c1df 100755 --- a/setup-zookeeper-env.sh +++ b/setup-zookeeper-env.sh @@ -1,8 +1,6 @@ #!/bin/bash set -x -e -. functions.sh - ZOO_CONF=/etc/zookeeper ZOO_BIN=/usr/share/zookeeper/bin ZOO_TMP_DIR=$(mktemp -d /tmp/ZOO-TMP-XXXXX) @@ -33,7 +31,7 @@ function start_zookeeper_server(){ sed -i -r "s@(ZOOCFGDIR *= *).*@\1$ZOO_TMP_DIR@" $ZOO_TMP_DIR/bin/zkEnv.sh mkdir $ZOO_TMP_DIR/log - sed -i -r "s@(ZOO_LOG_DIR *= *).*@\1$ZOO_TMP_DIR/log@" $ZOO_TMP_DIR/bin/vzkEnv.sh + sed -i -r "s@(ZOO_LOG_DIR *= *).*@\1$ZOO_TMP_DIR/log@" $ZOO_TMP_DIR/bin/zkEnv.sh $ZOO_TMP_DIR/bin/zkServer.sh start } @@ -45,7 +43,7 @@ function stop_zookeeper_server(){ trap "clean_exit" EXIT -if ! check_port 2181 && [ -d $ZOO_CONF ]; then +if [ -d $ZOO_CONF ]; then start_zookeeper_server if [ $? -eq 0 ]; then ZOOKEEPER_STARTED=1