diff options
| author | Krishnan Parthasarathi <kparthas@redhat.com> | 2012-06-13 11:27:54 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-06-13 23:58:40 +0530 | 
| commit | a83d2539ec7dbb6663444e88560e65db64bc8076 (patch) | |
| tree | eabdfa9358b4695255322d7d424251ed406b1753 /extras/hook-scripts/start/post/S30samba-start.sh | |
| parent | fb6f8c05d6fd804fe5d412149ebf7badf55a7b64 (diff) | |
hooks: Added fstab entry for samba share
- Add fstab entry for samba shares exported via hooks only on
  successfully mounting
- Remove fstab entry for samba export in samba-stop script
- Fixed an unintentional use of 'function-local' variable
  in shell script which relies on bash's variable scope internals.
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'extras/hook-scripts/start/post/S30samba-start.sh')
| -rw-r--r-- | extras/hook-scripts/start/post/S30samba-start.sh | 15 | 
1 files changed, 14 insertions, 1 deletions
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh index 60c192aad08..b61c59cd3b5 100644 --- a/extras/hook-scripts/start/post/S30samba-start.sh +++ b/extras/hook-scripts/start/post/S30samba-start.sh @@ -41,9 +41,22 @@ function sighup_samba () {          fi  } +function add_fstab_entry () { +        volname=$1 +        mntpt=$2 +        mntent="`hostname`:/$volname $mntpt glusterfs defaults,transport=tcp 0 0" +        exists=`grep "$mntent" /etc/fstab` +        if [ "$exists" == "" ] +        then +            echo "$mntent" >> /etc/fstab +        fi +} +  parse_args $@  add_samba_export $VOL $MNT_PRE +mkdir -p $MNT_PRE/$VOL  sleep 5 -mount -t glusterfs `hostname`:$volname $mnt_pre/$volname +mount -t glusterfs `hostname`:$VOL $MNT_PRE/$VOL && \ +        add_fstab_entry $VOL $MNT_PRE/$VOL  sighup_samba  | 
