mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
Rearrange xmpp hostname change scripts so we can only restart ejabberd once.
This commit is contained in:
parent
2c41e63889
commit
dadfb2220a
@ -37,6 +37,18 @@ DEBIAN_FRONTEND=noninteractive dpkg-reconfigure jwchat
|
|||||||
# Debconf can't handle our manual changes to ejabberd's config yet.
|
# Debconf can't handle our manual changes to ejabberd's config yet.
|
||||||
sed -i "s/$old_hostname/$hostname/g" /etc/ejabberd/ejabberd.cfg
|
sed -i "s/$old_hostname/$hostname/g" /etc/ejabberd/ejabberd.cfg
|
||||||
|
|
||||||
|
# Install the backup file as a fallback
|
||||||
|
ejabberdctl --node $OLDNODE install_fallback $NEWFILE
|
||||||
|
|
||||||
|
# Convert the backup to new node name
|
||||||
|
ejabberdctl --node $OLDNODE mnesia_change_nodename $OLDNODE $NEWNODE $OLDFILE $NEWFILE
|
||||||
|
|
||||||
|
# Stop ejabberd
|
||||||
|
ejabberdctl --node $OLDNODE stop
|
||||||
|
|
||||||
|
# Wait for old node to completely shutdown
|
||||||
|
sleep 10
|
||||||
|
|
||||||
# Make sure there aren't files in the Mnesia spool dir
|
# Make sure there aren't files in the Mnesia spool dir
|
||||||
mkdir -p /var/lib/ejabberd/oldfiles
|
mkdir -p /var/lib/ejabberd/oldfiles
|
||||||
mv /var/lib/ejabberd/*.* /var/lib/ejabberd/oldfiles/
|
mv /var/lib/ejabberd/*.* /var/lib/ejabberd/oldfiles/
|
||||||
@ -44,24 +56,5 @@ mv /var/lib/ejabberd/*.* /var/lib/ejabberd/oldfiles/
|
|||||||
# Start ejabberd
|
# Start ejabberd
|
||||||
service ejabberd restart
|
service ejabberd restart
|
||||||
|
|
||||||
# It can take a while to start up...
|
# Remove old hostname from /etc/hosts
|
||||||
for i in {1..12}
|
sed -i "/$old_hostname/d" /etc/hosts
|
||||||
do
|
|
||||||
if ejabberdctl status ; then
|
|
||||||
break
|
|
||||||
else
|
|
||||||
sleep 10
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Convert the backup to new node name
|
|
||||||
ejabberdctl mnesia_change_nodename $OLDNODE $NEWNODE $OLDFILE $NEWFILE
|
|
||||||
|
|
||||||
# Install the backup file as a fallback
|
|
||||||
ejabberdctl install_fallback $NEWFILE
|
|
||||||
|
|
||||||
# Stop ejabberd
|
|
||||||
ejabberdctl stop
|
|
||||||
|
|
||||||
# Start ejabberd
|
|
||||||
service ejabberd restart
|
|
||||||
|
|||||||
@ -21,4 +21,6 @@
|
|||||||
|
|
||||||
OLDFILE=/tmp/old.backup
|
OLDFILE=/tmp/old.backup
|
||||||
ejabberdctl backup $OLDFILE
|
ejabberdctl backup $OLDFILE
|
||||||
ejabberdctl stop
|
|
||||||
|
# Add old hostname to /etc/hosts so we can still access the running node.
|
||||||
|
echo "127.0.0.1 `hostname`" >>/etc/hosts
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user