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

vz/remount.sh: cleanup spec, add verbose

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