Fix style and remove a random if...
This commit is contained in:
parent
1bdabe1a5a
commit
3a39368bdc
1 changed files with 63 additions and 64 deletions
|
@ -102,37 +102,37 @@ EOF
|
||||||
........................
|
........................
|
||||||
EOF
|
EOF
|
||||||
cat > "$path"/snapshot.conf << EOF
|
cat > "$path"/snapshot.conf << EOF
|
||||||
0 0 0 * 0 0 0
|
0 0 0 * 0 0 0
|
||||||
EOF
|
EOF
|
||||||
echo " done with /$volume/$item."
|
echo " done with /$volume/$item."
|
||||||
}
|
}
|
||||||
|
|
||||||
backup_configs() {
|
backup_configs() {
|
||||||
cd "/$volume/._share/"
|
cd "/$volume/._share/"
|
||||||
tar -cf "/var/backups/$volume_sharelunconfig.$(date +%s).tar" ./* 2>/dev/null
|
tar -cf "/var/backups/$volume_sharelunconfig.$(date +%s).tar" ./* 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "==============================="
|
echo "==============================="
|
||||||
echo "Share and iSCSI Rebuild v6.8.0"
|
echo "Share and iSCSI Rebuild v6.8.0"
|
||||||
echo "==============================="
|
echo "==============================="
|
||||||
echo "Querying readynasd for list of volumes..."
|
echo "Querying readynasd for list of volumes..."
|
||||||
|
|
||||||
x=$(rn_nml -g volumes 2>/dev/null) # find if readynasd is running
|
x=$(rn_nml -g volumes 2>/dev/null) # find if readynasd is running
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then # if readynasd was successful
|
if [[ $? -eq 0 ]]; then # if readynasd was successful
|
||||||
x=$(echo "$x"| grep "resource-id" | sed 's/^.*id="//;s/".*//;') # then parse it
|
x=$(echo "$x"| grep "resource-id" | sed 's/^.*id="//;s/".*//;') # then parse it
|
||||||
readynasd=1
|
readynasd=1
|
||||||
elif [[ $? -eq 1 ]] ; then # but if it wasn't
|
elif [[ $? -eq 1 ]] ; then # but if it wasn't
|
||||||
echo "readynasd not available; doing alternative lookup for shares" # inform intent
|
echo "readynasd not available; doing alternative lookup for shares" # inform intent
|
||||||
x=$(find / -maxdepth 2 -name "._share" | sed 's/^\///g;s/\/.*//') # create new list
|
x=$(find / -maxdepth 2 -name "._share" | sed 's/^\///g;s/\/.*//') # create new list
|
||||||
fi
|
fi
|
||||||
|
|
||||||
number=$(echo "$x" | wc -w)
|
number=$(echo "$x" | wc -w)
|
||||||
|
|
||||||
if [[ ! $number ]]; then
|
if [[ ! $number ]]; then
|
||||||
echo "No volumes found!"
|
echo "No volumes found!"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "$number volume(s) found."
|
echo "$number volume(s) found."
|
||||||
echo -n "Beginning in 3..."; sleep 1; echo -n " 2..."; sleep 1; echo " 1..."; sleep 1
|
echo -n "Beginning in 3..."; sleep 1; echo -n " 2..."; sleep 1; echo " 1..."; sleep 1
|
||||||
echo "==============================="
|
echo "==============================="
|
||||||
|
@ -156,17 +156,16 @@ EOF
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
echo "= done with /$volume"
|
echo "= done with /$volume"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $found -gt 0 ]] && [[ $readynasd ]] ; then
|
if [[ $found -gt 0 ]] && [[ $readynasd ]] ; then
|
||||||
echo "*** Restarting readynasd to finish changes... ***"
|
echo "*** Restarting readynasd to finish changes... ***"
|
||||||
systemctl restart readynasd
|
systemctl restart readynasd
|
||||||
else
|
else
|
||||||
echo "Not starting readynasd because it returned a bad message earlier; restart manually."
|
echo "Not starting readynasd because it returned a bad message earlier; restart manually."
|
||||||
fi
|
|
||||||
|
|
||||||
echo "================================================="
|
|
||||||
echo "| Completed share creation! We were able to |"
|
|
||||||
echo "| rebuild $shares shares and $iscsi LUNs. |"
|
|
||||||
echo "================================================="
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "================================================="
|
||||||
|
echo "| Completed share creation! We were able to |"
|
||||||
|
echo "| rebuild $shares shares and $iscsi LUNs. |"
|
||||||
|
echo "================================================="
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue