diff options
| author | Vijay Bellur <vijay@gluster.com> | 2012-06-12 14:53:04 +0530 |
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-06-12 14:53:04 +0530 |
| commit | b28cab6483991e27078102075d29e2f15c967015 (patch) | |
| tree | 0461b092fbeec600fc797867c1eb5d063548e58a /extras/hook-scripts/stop | |
| parent | 8e64475d72c6db64240df21a20a02fbae22609e2 (diff) | |
hooks: Changes for samba start and stop
Diffstat (limited to 'extras/hook-scripts/stop')
| -rw-r--r-- | extras/hook-scripts/stop/pre/S30samba-stop.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/extras/hook-scripts/stop/pre/S30samba-stop.sh b/extras/hook-scripts/stop/pre/S30samba-stop.sh new file mode 100644 index 00000000000..783171a437e --- /dev/null +++ b/extras/hook-scripts/stop/pre/S30samba-stop.sh @@ -0,0 +1,53 @@ +#! /bin/bash + +PROGNAME="Ssamba-stop" +OPTSPEC="volname:" +VOL= +MNT_PRE="/mnt/samba" + +function parse_args () { + ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@) + eval set -- "$ARGS" + + while true; do + case $1 in + --volname) + shift + VOL=$1 + ;; + *) + shift + break + ;; + esac + shift + done +} + +function del_samba_export () { + volname=$1 + cp /etc/samba/smb.conf /tmp/smb.conf + sed -i "/gluster-$volname/,/^$/d" /tmp/smb.conf &&\ + mv /tmp/smb.conf /etc/samba/smb.conf +} + +function umount_volume () { + volname=$1 + mnt_pre=$2 + umount -l $mnt_pre/$volname +} + +function sighup_samba () { + pid=`cat /var/run/smbd.pid` + if [ $pid != " " ] + then + kill -HUP $pid; + else + /etc/init.d/smb start + fi +} + +parse_args $@ +del_samba_export $VOL +umount_volume $VOL $MNT_PRE +sighup_samba |
