Commit 6d074020 authored by Vitaly Lipatov's avatar Vitaly Lipatov

clone_vz_to_azbykar.sh: small improve

parent 930ca98c
......@@ -13,22 +13,23 @@ HOMEDIR=/azbyka
FROM=/var/lib/vz/private/$1
TO=/var/lib/vz/private/$2
CFGDIR=/etc/vz/conf
VEID=$2
#RSYNC="rsync -e \"ssh -c arcfour\""
rsync -e "ssh -c arcfour" -avPH $FROM/ $TOHOST:$TO/ || exit
VEID=$2
ssh $TOHOST mkdir -p /var/lib/vz/root/$VEID/ || exit
scp $CFGDIR/$1.conf $TOHOST:$CFGDIR/$VEID.conf || exit
cat <<EOF | ssh $TOHOST tee $CFGDIR/$2.mount >/dev/null
cat <<EOF | ssh $TOHOST tee $CFGDIR/$VEID.mount >/dev/null
#!/bin/bash
# Mount script to bind-mount /var/something into a VPS
export VEID=\$(basename \$0 .mount)
. /etc/vz/vz.conf
mount --bind $HOMEDIR /var/lib/vz/root/\$VEID/home
EOF
ssh $TOHOST chmod u+x $CFGDIR/$2.mount
ssh $TOHOST chmod u+x $CFGDIR/$VEID.mount
AZBYKAMAIN=91.232.225.22
cat <<EOF | ssh $TOHOST sh -
......@@ -36,7 +37,13 @@ subst "s|^IP_ADDRESS=\"192.168.3.*|IP_ADDRESS=\"192.168.3.$VEID\"|g" $CFGDIR/$VE
# mysql
subst "s|192.168.3.191|$AZBYKAMAIN|g" $TO/etc/hosts
# memcached
subst "s|192.168.3.188|$AZBYKAMAIN|g" $TO/etc/hosts
# commented, use local memcached
#subst "s|192.168.3.188|$AZBYKAMAIN|g" $TO/etc/hosts
vzctl start $VEID || exit
sleep 10
vzctl exec $VEID nscd -i hosts
EOF
#echo "Start update_cloned_vz.sh now"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment