From a8530f4a10964aae1e7faf52ff5ff58d68b689e9 Mon Sep 17 00:00:00 2001 From: Cody Cook Date: Tue, 22 Aug 2017 16:08:02 -0700 Subject: [PATCH] Update iscsi_fix.sh to add multi-volume support --- iscsi_fix.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/iscsi_fix.sh b/iscsi_fix.sh index 5094b00..ba56831 100644 --- a/iscsi_fix.sh +++ b/iscsi_fix.sh @@ -1,6 +1,17 @@ #!/bin/bash +# iscsi share fix +# use this script to rebuild default configs for shares if the ._share becomes +# broken for whatever reason. ( -volume="data" -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;done +x=$(rn_nml -g volumes | grep "resource-id" | sed 's/^.*id="//;s/".*//;') +for volume in "$x" +do + 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 + done +done ) \ No newline at end of file