Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#/bin/bash
DEV_DIR=riak-1.2.1/dev
for i in 1 2 3 4
do
PORT_PREFIX=99${i}
APP_CONFIG=${DEV_DIR}/dev${i}/etc/app.config
cp $APP_CONFIG $APP_CONFIG.bak
perl -pi -e "s/(pb_port,)\s*\d+/\1 ${PORT_PREFIX}1/" $APP_CONFIG
perl -pi -e "s/(http,.*127.0.0.1.*,)\s*\d+/\1 ${PORT_PREFIX}2/" $APP_CONFIG
perl -pi -e "s/(https,.*127.0.0.1.*,)\s*\d+/\1 ${PORT_PREFIX}2/" $APP_CONFIG
perl -pi -e "s/(handoff_port,)\s*\d+/\1 ${PORT_PREFIX}3/" $APP_CONFIG
VM_ARGS=${DEV_DIR}/dev${i}/etc/vm.args
cp $VM_ARGS $VM_ARGS.bak
perl -pi -e "s/name riak\d*(\@127.0.0.1)/name riak${i}\1/" $VM_ARGS
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment