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/start | |
| parent | 8e64475d72c6db64240df21a20a02fbae22609e2 (diff) | |
hooks: Changes for samba start and stop
Diffstat (limited to 'extras/hook-scripts/start')
| -rw-r--r-- | extras/hook-scripts/start/post/S30samba-start.sh | 19 | ||||
| -rw-r--r-- | extras/hook-scripts/start/post/S30samba-stop.sh | 60 |
2 files changed, 3 insertions, 76 deletions
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh index 5c7b6574e36..60c192aad08 100644 --- a/extras/hook-scripts/start/post/S30samba-start.sh +++ b/extras/hook-scripts/start/post/S30samba-start.sh @@ -1,11 +1,8 @@ #!/bin/bash -#Need to be copied to hooks/<HOOKS_VER>/start/post PROGNAME="Ssamba-start" -OPTSPEC="volname:,mnt:" +OPTSPEC="volname:" VOL= -#FIXME: glusterd hook interface will eventually provide mntpt prefix as -# command line arg MNT_PRE="/mnt/samba" function parse_args () { @@ -18,10 +15,6 @@ function parse_args () { shift VOL=$1 ;; - --mnt) - shift - MNT_PRE=$1 - ;; *) shift break @@ -38,13 +31,6 @@ function add_samba_export () { printf "\n[gluster-$volname]\ncomment=For samba export of volume $volname\npath=$mnt_pre/$volname\nread only=no\nguest ok=yes\n" >> /etc/samba/smb.conf } -function mount_volume () { - volname=$1 - mnt_pre=$2 - #Mount shouldn't block on glusterd to fetch volfile, hence the 'bg' - mount -t glusterfs `hostname`:$volname $mnt_pre/$volname & -} - function sighup_samba () { pid=`cat /var/run/smbd.pid` if [ $pid != " " ] @@ -58,5 +44,6 @@ function sighup_samba () { parse_args $@ add_samba_export $VOL $MNT_PRE -mount_volume $VOL $MNT_PRE +sleep 5 +mount -t glusterfs `hostname`:$volname $mnt_pre/$volname sighup_samba diff --git a/extras/hook-scripts/start/post/S30samba-stop.sh b/extras/hook-scripts/start/post/S30samba-stop.sh deleted file mode 100644 index 0886f91bf9d..00000000000 --- a/extras/hook-scripts/start/post/S30samba-stop.sh +++ /dev/null @@ -1,60 +0,0 @@ -#! /bin/bash -#Need to be copied to hooks/<HOOKS_VER>/stop/post - -PROGNAME="Ssamba-stop" -OPTSPEC="volname:,mnt:" -VOL= -#FIXME: gluster will eventually pass mnt prefix as command line argument -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 - ;; - --mnt) - shift - MNT_PRE=$1 - echo $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 |
