Commit 0cb8f581 authored by Vinicius Ruoso's avatar Vinicius Ruoso

Added more protections when running fixhome on prd_fixraid script

When something goes wrong running the fixhome routine, the school must
return to the state before running it. The code added will make sure all
becomes normal if some error happens.
Signed-off-by: default avatarVinicius Ruoso <vkr07@c3sl.ufpr.br>
parent 4d72299f
......@@ -91,7 +91,7 @@ EOF
# umount and stop md4 and md5
print "FIXHOME: STOPING md4 AND md5" &&
umount /home /mnt &&
umount /home /mnt &>/dev/null &&
mdadm --stop /dev/md4 &>/dev/null &&
mdadm --stop /dev/md5 &>/dev/null &&
print "FIXHOME: RE-CREATING MD4" &&
......@@ -104,6 +104,16 @@ EOF
rm /etc/nologin "$LOCK" &> /dev/null &&
FAILED=0
# if something goes wrong
if (( "$?" != "0" )); then
print "FIXHOME: ABORTING, POS-RSYNC ISSUE"
umount /mnt &> /dev/null
mount /home &> /dev/null
mdadm --stop /dev/md5 &> /dev/null
rm /etc/nologin "$LOCK" &> /dev/null
return 1
fi
print "FIXHOME: FINISHED"
else
print "FIXHOME: ABORTING, NOT A GOOD TIME"
......
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