diff options
Diffstat (limited to 'extras/hook-scripts/reset')
-rw-r--r-- | extras/hook-scripts/reset/Makefile.am | 2 | ||||
-rw-r--r-- | extras/hook-scripts/reset/post/Makefile.am | 1 | ||||
-rwxr-xr-x | extras/hook-scripts/reset/post/S31ganesha-reset.sh | 38 | ||||
-rw-r--r-- | extras/hook-scripts/reset/pre/Makefile.am | 1 |
4 files changed, 42 insertions, 0 deletions
diff --git a/extras/hook-scripts/reset/Makefile.am b/extras/hook-scripts/reset/Makefile.am new file mode 100644 index 00000000000..6e2701e909e --- /dev/null +++ b/extras/hook-scripts/reset/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = post pre +CLEANFILES = diff --git a/extras/hook-scripts/reset/post/Makefile.am b/extras/hook-scripts/reset/post/Makefile.am new file mode 100644 index 00000000000..fcdd8ab55ba --- /dev/null +++ b/extras/hook-scripts/reset/post/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = S31ganesha-reset.sh diff --git a/extras/hook-scripts/reset/post/S31ganesha-reset.sh b/extras/hook-scripts/reset/post/S31ganesha-reset.sh new file mode 100755 index 00000000000..68411e4bd95 --- /dev/null +++ b/extras/hook-scripts/reset/post/S31ganesha-reset.sh @@ -0,0 +1,38 @@ +#/bin/bash +PROGNAME="Sganesha-reset" +OPTSPEC="volname:" +VOL= + +function parse_args () { + ARGS=$(getopt -l $OPTSPEC -o "o" -name $PROGNAME $@) + eval set -- "$ARGS" + case $1 in + --volname) + shift + VOL=$1 + ;; + esac +} + +function is_volume_started () { + volname=$1 + echo "$(grep status /var/lib/glusterd/vols/"$volname"/info |\ + cut -d"=" -f2)" +} + +parse_args $@ +if ps aux | grep -q "[g]anesha.nfsd" + then + kill -s TERM `cat /var/run/ganesha.pid` + sleep 10 + rm -rf /var/lib/ganesha/exports + rm -rf /var/lib/ganesha/export_added + sed -i /conf/d /var/lib/ganesha/nfs-ganesha.conf + if [ "1" = $(is_volume_started "$VOL") ]; + then + gluster volume start $VOL force + fi +fi + + + diff --git a/extras/hook-scripts/reset/pre/Makefile.am b/extras/hook-scripts/reset/pre/Makefile.am new file mode 100644 index 00000000000..1b336ac1a85 --- /dev/null +++ b/extras/hook-scripts/reset/pre/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = |