blob: b678cebac2d2677433959ee1ce5241c4458983f2 (
plain)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/bin/bash # This must be renamed to the name of the relation. The goal here is to # affect any change needed by relationships being formed # This script should be idempotent. set -ux DEFAULT_REPLSET_NAME=`config-get replicaset` REPLICASET_MASTER=`config-get replicaset_master` ############################################################################################################ # Are we connecting to an existing replica set? ############################################################################################################ if [ "${REPLICASET_MASTER}" != "auto" ]; then grep "${DEFAULT_REPLSET_NAME}" /etc/init/mongodb.conf if [ $? -ne 0 ];then sed -i -e "s/ -- / -- --replSet ${DEFAULT_REPLSET_NAME} /" /etc/init/mongodb.conf service mongodb stop rm -f /var/lib/mongodb/mongod.lock service mongodb start fi mongo --host ${REPLICASET_MASTER} --eval "rs.add(\""${HOSTNAME}"\")" fi
|