From fdc08739f154f07dc6e6eaaa1e4bec2c49c95f31 Mon Sep 17 00:00:00 2001 From: Cody Cook Date: Tue, 22 Aug 2017 16:43:34 -0700 Subject: [PATCH] Update for 6.8 --- iscsi_fix.sh | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/iscsi_fix.sh b/iscsi_fix.sh index ba56831..219237b 100644 --- a/iscsi_fix.sh +++ b/iscsi_fix.sh @@ -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 -) \ No newline at end of file +