summaryrefslogtreecommitdiffstats
path: root/extras/hook-scripts/S30samba-set.sh
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hook-scripts/S30samba-set.sh')
-rwxr-xr-xextras/hook-scripts/S30samba-set.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/extras/hook-scripts/S30samba-set.sh b/extras/hook-scripts/S30samba-set.sh
index 33ffca3d7..6b11f5a4f 100755
--- a/extras/hook-scripts/S30samba-set.sh
+++ b/extras/hook-scripts/S30samba-set.sh
@@ -63,6 +63,8 @@ function add_samba_share () {
STRING+="comment = For samba share of volume $volname\n"
STRING+="vfs objects = glusterfs\n"
STRING+="glusterfs:volume = $volname\n"
+ STRING+="glusterfs:logfile = /var/log/samba/glusterfs-$volname.%%M.log\n"
+ STRING+="glusterfs:loglevel = 7\n"
STRING+="path = /\n"
STRING+="read only = no\n"
STRING+="guest ok = yes\n"
@@ -71,7 +73,7 @@ function add_samba_share () {
function sighup_samba () {
pid=`cat /var/run/smbd.pid`
- if [ "$pid" != "" ]
+ if [ "x$pid" != "x" ]
then
kill -HUP "$pid";
else
@@ -81,9 +83,7 @@ function sighup_samba () {
function del_samba_share () {
volname=$1
- cp /etc/samba/smb.conf /tmp/smb.conf
- sed -i "/gluster-$volname/,/^$/d" /tmp/smb.conf &&\
- cp /tmp/smb.conf /etc/samba/smb.conf
+ sed -i "/\[gluster-$volname\]/,/^$/d" /etc/samba/smb.conf
}
function is_volume_started () {
@@ -98,8 +98,10 @@ if [ "0" = $(is_volume_started "$VOL") ]; then
fi
if [ "$enable_smb" = "enable" ]; then
- add_samba_share $VOL
- sighup_samba
+ if ! grep --quiet "\[gluster-$VOL\]" /etc/samba/smb.conf ; then
+ add_samba_share $VOL
+ sighup_samba
+ fi
elif [ "$enable_smb" = "disable" ]; then
del_samba_share $VOL