Skip to content

Instantly share code, notes, and snippets.

@sanderploegsma
Created August 22, 2018 20:20
Show Gist options
  • Save sanderploegsma/c749a315271eb68ba4d5d52e46f3d44e to your computer and use it in GitHub Desktop.
Save sanderploegsma/c749a315271eb68ba4d5d52e46f3d44e to your computer and use it in GitHub Desktop.
#!/bin/sh
CLUSTER_CONFIG="/data/nodes.conf"
if [ -f ${CLUSTER_CONFIG} ]; then
if [ -z "${POD_IP}" ]; then
echo "Unable to determine Pod IP address!"
exit 1
fi
echo "Updating my IP to ${POD_IP} in ${CLUSTER_CONFIG}"
sed -i.bak -e '/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/' ${CLUSTER_CONFIG}
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment