Commit d55e3e74 authored by Luca Cinquini's avatar Luca Cinquini
Browse files

Fixing problem with adding/removing shards

parent 6300d33d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -68,7 +68,9 @@ if ! [[ $shard_name == 'master' || $shard_name == 'slave' ]]; then
  shards_file="/esg/config/esgf_shards_static.xml"
  if ! grep -q ${shard_port} ${shards_file} ; then
    echo "Adding shard to ${shards_file}"
    # following not currently working on distributed nodes
    #sed -i 's/<\/shards>/    <value>localhost:'${shard_port}'\/solr<\/value>\n<\/shards>/g' ${shards_file}
    # note: must work around the error: "sed: cannot rename /esg/config/sedFvmijX: Device or resource busy"
    sed 's/<\/shards>/    <value>localhost:'${shard_port}'\/solr<\/value>\n<\/shards>/g' ${shards_file} > ${shards_file}.new
    # call "/bin/cp" since for root cp is aliased to "cp -i" (which asks for confirmation)
    /bin/cp -f ${shards_file}.new ${shards_file}
  fi
fi
+4 −1
Original line number Diff line number Diff line
@@ -43,7 +43,10 @@ if ! [[ $shard_name == 'master' || $shard_name == 'slave' ]]; then
  shards_file="/esg/config/esgf_shards_static.xml"
  if grep -q ${shard_port} ${shards_file} ; then
    echo "Removing shard from ${shards_file}"
    #sed -i '/localhost:'${shard_port}'/d' ${shards_file}
    # note: must work around the error: "sed: cannot rename /esg/config/sedFvmijX: Device or resource busy"
    sed '/localhost:'${shard_port}'/d' ${shards_file} > ${shards_file}.new
    # call "/bin/cp" since for root cp is aliased to "cp -i" (which asks for confirmation)
    /bin/cp -f ${shards_file}.new ${shards_file}
  fi

fi