Commit 002b4ea3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

vz/remount.sh: cleanup spec, add verbose

parent 68135b84
...@@ -4,32 +4,32 @@ ...@@ -4,32 +4,32 @@
#without complete restart of all vz. #without complete restart of all vz.
#The only parameter is the resource to be mount. #The only parameter is the resource to be mount.
if [ ${#} -eq 0 ] if [ ${#} -eq 0 ] ; then
then
echo 'Put the full path of the resource here, i.e.: ./remount.sh /var/ftp/pvt' echo 'Put the full path of the resource here, i.e.: ./remount.sh /var/ftp/pvt'
exit 1 exit 1
fi fi
LIST="$(mount -l|grep vz/root|grep "${1}")" LIST="$(mount -l | grep vz/root | grep "${1}")"
LISTNUM="$(echo "${LIST}"|sed -e 's%.*\/root\/%%g'|sed -e 's/\/.*//g')" LISTNUM="$(echo "${LIST}" | sed -e 's%.*\/root\/%%g' | sed -e 's/\/.*//g')"
echo 'The list of vz containers, where the resource had been mounted:' echo 'The list of vz containers, where the resource had been mounted:'
echo "$LISTNUM"|tr '\n' ' ' echo "$LISTNUM" | tr '\n' ' '
echo echo
for i in $LISTNUM
do for i in $LISTNUM ; do
umount -fl "/var/lib/vz/root/${i}${1}" umount -flv "/var/lib/vz/root/${i}${1}"
done done
sleep 1 sleep 1
umount -fl "${1}" umount -fvl "${1}"
sleep 1 sleep 1
# mount.glusterfs does not support -v
mount "${1}" mount "${1}"
sleep 1 sleep 1
for i in $LISTNUM for i in $LISTNUM ; do
do vzctl exec ${i} mount -a
vzctl exec ${i} mount -a sleep 3
sleep 3 mount -l | grep -q "/var/lib/vz/root/${i}${1}" && continue
[ $(mount -l|grep -c "/var/lib/vz/root/${i}${1}" ) -eq 0 ] && mount -o bind "${1}" "/var/lib/vz/root/${i}${1}" mount -vo bind "${1}" "/var/lib/vz/root/${i}${1}"
done done
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