Major updates
This commit is contained in:
parent
22ec501225
commit
c768b82b81
1 changed files with 44 additions and 30 deletions
|
@ -8,9 +8,9 @@ shares=0
|
|||
iscsi=0
|
||||
share_create() {
|
||||
found=$((found+1))
|
||||
share=$((share+1))
|
||||
shares=$((shares+1))
|
||||
path="/$volume/._share/$item"
|
||||
echo -e "=== Found share at /$volume/$item... recreating share configs...".
|
||||
echo -n "=== Found share at /$volume/$item... recreating share configs...".
|
||||
mkdir -p "$path"
|
||||
echo "share" > "$path"/datasettype.conf
|
||||
echo "0,0" > "$path"/recycle.conf
|
||||
|
@ -71,14 +71,14 @@ EOF
|
|||
cd "$path"
|
||||
chown root.root datasettype.conf recycle.conf snapdir.conf snapshot.conf
|
||||
chown admin.admin afp.conf fs.conf ftp.conf nfs.conf samba.conf custom_snapshot_management.conf custom_snapshot_schedule.conf
|
||||
echo " Done with /$volume/$item."
|
||||
echo " done with /$volume/$item."
|
||||
}
|
||||
|
||||
iscsi_create() {
|
||||
iscsi=$((iscsi+1))
|
||||
found=$((found+1))
|
||||
path="/$volume/._share/$item"
|
||||
echo -e "=== Found LUN at /$volume/$item... recreating iSCSI configs...".
|
||||
echo -ne "=== Found LUN at /$volume/$item... recreating iSCSI configs...".
|
||||
mkdir -p "$path"
|
||||
cat > "$path"/iscsi.conf << EOF
|
||||
comment
|
||||
|
@ -104,11 +104,13 @@ EOF
|
|||
cat > "$path"/snapshot.conf << EOF
|
||||
0 0 0 * 0 0 0
|
||||
EOF
|
||||
echo " Done with /$volume/$item."
|
||||
|
||||
|
||||
echo " done with /$volume/$item."
|
||||
}
|
||||
|
||||
backup_configs() {
|
||||
cd "/$volume/._share/"
|
||||
tar -cf "/var/backups/$volume_sharelunconfig.$(date +%s).tar" ./*
|
||||
}
|
||||
|
||||
echo "==============================="
|
||||
echo "Share and iSCSI Rebuild v6.8.0"
|
||||
|
@ -126,29 +128,41 @@ elif [[ $? -eq 1 ]] ; then # but if it wasn't
|
|||
fi
|
||||
|
||||
number=$(echo "$x" | wc -w)
|
||||
echo "$number volume(s) found."
|
||||
echo -n "Beginning in 3..."; sleep 1; echo -n " 2..."; sleep 1; echo -n " 1..."; sleep 1
|
||||
echo "==============================="
|
||||
echo "=== All right! Time to go! ==="
|
||||
echo "==============================="
|
||||
for volume in $x; do
|
||||
echo "= Investigating volume /$volume..."
|
||||
objects=$(ls -A /$volume | egrep -v "^.apps$|^home$|^.purge$|^._share$|^.timemachine$|^.vault$|^.TemporaryItems$")
|
||||
echo "= Objects found:" $objects
|
||||
for item in $objects; do
|
||||
echo "== Reviewing $item"
|
||||
if ls -QdA /$volume/$item/.iscsi >/dev/null 2>&1; then
|
||||
iscsi_create
|
||||
else
|
||||
share_create
|
||||
fi
|
||||
done
|
||||
echo "= done with /$volume="
|
||||
done
|
||||
|
||||
if [[ $found -gt 0 ]] && [[ $readynasd ]] ; then
|
||||
echo "Restarting readynasd to finish changes..."
|
||||
systemctl restart readynasd
|
||||
if [[ ! $number ]]; then
|
||||
echo "No volumes found!"
|
||||
exit 1
|
||||
else
|
||||
echo "Not starting readynasd because it returned a bad message earlier; restart manually."
|
||||
echo "$number volume(s) found."
|
||||
echo -n "Beginning in 3..."; sleep 1; echo -n " 2..."; sleep 1; echo " 1..."; sleep 1
|
||||
echo "==============================="
|
||||
echo "=== All right! Time to go! ==="
|
||||
echo "==============================="
|
||||
for volume in $x; do
|
||||
echo "= Investigating volume /$volume..."
|
||||
objects=$(ls -A /"$volume" | egrep -v "^.apps$|^home$|^.purge$|^._share$|^.timemachine$|^.vault$|^.TemporaryItems$")
|
||||
echo "= Objects found:" $objects
|
||||
backup_configs
|
||||
for item in $objects; do
|
||||
echo "== Reviewing $item"
|
||||
if ls -QdA /"$volume"/"$item"/.iscsi >/dev/null 2>&1; then
|
||||
iscsi_create
|
||||
else
|
||||
share_create
|
||||
fi
|
||||
done
|
||||
echo "= done with /$volume"
|
||||
done
|
||||
|
||||
if [[ $found -gt 0 ]] && [[ $readynasd ]] ; then
|
||||
echo "*** Restarting readynasd to finish changes... ***"
|
||||
systemctl restart readynasd
|
||||
else
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue