#!/bin/bash # GENERATE a dynomite yaml configuration based on DYNO_NODE env. variable and 'seeds.list' file. NODE=${DYNO_NODE:-"dynomite:8101:rack-1:datacenter-1:0"} IFS=':' read -r -a NODEandPORTandRACKandDATACENTERandTOKEN <<< "$NODE" echo "I am $NODE" { printf 'dyn_o_mite:\n' printf ' datacenter: %s\n' "${NODEandPORTandRACKandDATACENTERandTOKEN[3]}" printf ' rack: %s\n' "${NODEandPORTandRACKandDATACENTERandTOKEN[2]}" printf ' dyn_listen: 0.0.0.0:8101\n' printf ' listen: 0.0.0.0:8102\n' printf ' dyn_seed_provider: simple_provider\n' printf ' dyn_seeds:\n' while IFS= read -r SEED_LINE; do if [ "$SEED_LINE" != "$NODE" ]; then printf ' - %s\n' "$SEED_LINE"; fi done < seeds.list printf ' tokens: %s\n' "${NODEandPORTandRACKandDATACENTERandTOKEN[4]}" printf ' servers:\n' printf ' - 127.0.0.1:22122:1\n' } > /dynomite/auto_dynomite.yml #Start redis server on 22122 redis-server --port 22122 & src/dynomite --conf-file=/dynomite/auto_dynomite.yml -v11