Commit ab302db9 authored by Vinicius Ruoso's avatar Vinicius Ruoso

Added function to kill logged users proccess on prd_fixraid

After rsync, it's necessary to umount /home. If some user proccess are using
disk resources on /home, the umount command will fail, and will not bem
possible to fix the RAID.

Killing all user remaining proccess will allow the umount command to execute
properly.
Signed-off-by: default avatarVinicius Ruoso <vkr07@c3sl.ufpr.br>
parent 0cb8f581
......@@ -18,6 +18,20 @@ function removefromraid(){
print "DIAGNOSE: FULLY REMOVED $DISK FROM RAID"
}
# function to kill all users remaining proccess
# this will prevent users with running proccess to use disks
function killusers(){
print "KILLUSERS: STARTED"
for USR in $(ps aux |awk '{print $1}' |sort -u); do
if (( $(id -u $USR 2>/dev/null || echo 0) > 2000 )); then
# its a normal user, must kill the proccess
kill $(ps -u $USR |awk 'NR>1{print $1}') &>/dev/null
fi
done
print "KILLUSERS: DONE"
sleep 5
}
# function to fix home's with different sizes
function fixhome(){
SMALL=$1
......@@ -62,6 +76,9 @@ Por favor, aguarde alguns minutos.
Equipe C3SL, UFPR
EOF
# kill users remaining proccess
killusers
# run the fix routine
FAILED=1
mknod /dev/md5 b 9 5 &> /dev/null
......
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