Update for 6.8

This commit is contained in:
Cody Cook 2017-08-22 16:43:34 -07:00
commit fdc08739f1

View file

@ -2,16 +2,45 @@
# iscsi share fix
# use this script to rebuild default configs for shares if the ._share becomes
# broken for whatever reason.
(
echo "Activating iSCSI share rebuilder"
echo "Querying readynasd for list of volumes..."
x=$(rn_nml -g volumes | grep "resource-id" | sed 's/^.*id="//;s/".*//;')
for volume in "$x"
number=$(echo $x | wc -w)
echo "$number volume(s) found."
for volume in ${x}
do
echo -n "Investigating volume /$volume..."
for i in `find /"$volume" -maxdepth 2 -type d -name ".iscsi" | sed "s/\/.iscsi//g;s/\/$volume\///g;"`
do
mkdir -p /"$volume"/._share/${i} cd /"$volume"/._share/${i}
echo "comment " > iscsi.conf
echo "0 0 0 * 0 0 0" > snapshot.conf
path="/$volume/._share/${i}"
echo "Found /$volume/${i}... recreating configs...".
mkdir -p $path
cat > $path/iscsi.conf << EOF
comment
alert_threshold 80
EOF
cat > $path/custom_snapshot_management.conf << EOF
enabled = no
retention_rule = lifetime
lifetime = 2592000
number = 30
nonempty_snapshots = yes
prev_versions = no
EOF
cat > $path/custom_snapshot_schedule.conf << EOF
........................
........................
........................
........................
........................
........................
........................
EOF
cat > $path/snapshot.conf << EOF
0 0 0 * 0 0 0
EOF
echo " Done with /$volume/${i}."
done
echo " Done with /$volume"
done
)