prevent race condition for ewsposter/ews.ip at first start

This commit is contained in:
Marco Ochse 2016-02-08 13:37:02 +01:00
parent ebb58955c4
commit 8165e8f91f
2 changed files with 14 additions and 0 deletions

View file

@ -71,3 +71,7 @@ nodeid =
iptableslog =
targetip =
[EMOBILITY]
eMobility = false
nodeid = emobility-community-01
logfile = /data/emobility/emobility.log

View file

@ -332,6 +332,16 @@ update-initramfs -u
sed -i 's#\#force_color_prompt=yes#force_color_prompt=yes#' /home/tsec/.bashrc
sed -i 's#\#force_color_prompt=yes#force_color_prompt=yes#' /root/.bashrc
# Let's create ews.ip before reboot and prevent race condition for first start
myLOCALIP=$(hostname -I | awk '{ print $1 }')
myEXTIP=$(curl myexternalip.com/raw)
sed -i "s#IP:.*#IP: $myLOCALIP, $myEXTIP#" /etc/issue
tee /data/ews/conf/ews.ip << EOF
[MAIN]
ip = $myEXTIP
EOF
chown tpot:tpot /data/ews/conf/ews.ip
# Final steps
fuECHO "### Thanks for your patience. Now rebooting."
mv /root/tpot/etc/rc.local /etc/rc.local && rm -rf /root/tpot/ && chage -d 0 tsec && sleep 2 && reboot