diff options
| -rwxr-xr-x | extras/hook-scripts/S30samba-set.sh | 12 | ||||
| -rwxr-xr-x | extras/hook-scripts/S30samba-start.sh | 4 | ||||
| -rwxr-xr-x | extras/hook-scripts/S30samba-stop.sh | 6 | 
3 files changed, 10 insertions, 12 deletions
diff --git a/extras/hook-scripts/S30samba-set.sh b/extras/hook-scripts/S30samba-set.sh index 87cd31c5a..5047660fe 100755 --- a/extras/hook-scripts/S30samba-set.sh +++ b/extras/hook-scripts/S30samba-set.sh @@ -73,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 @@ -83,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 () { @@ -100,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 diff --git a/extras/hook-scripts/S30samba-start.sh b/extras/hook-scripts/S30samba-start.sh index 191b1dbb4..9f1b20a25 100755 --- a/extras/hook-scripts/S30samba-start.sh +++ b/extras/hook-scripts/S30samba-start.sh @@ -73,7 +73,7 @@ function add_samba_share () {  function sighup_samba () {          pid=`cat ${PIDDIR}/smbd.pid` -        if [ "$pid" != "" ] +        if [ "x$pid" != "x" ]          then                  kill -HUP "$pid";          else @@ -104,7 +104,7 @@ fi  #Find smb.conf, smbd pid directory and smbd logfile path  find_config_info -if ! grep --quiet "gluster-$VOL" ${CONFIGFILE} ; then +if ! grep --quiet "\[gluster-$VOL\]" ${CONFIGFILE} ; then          add_samba_share $VOL          sighup_samba  fi diff --git a/extras/hook-scripts/S30samba-stop.sh b/extras/hook-scripts/S30samba-stop.sh index f7150c10e..8950eea43 100755 --- a/extras/hook-scripts/S30samba-stop.sh +++ b/extras/hook-scripts/S30samba-stop.sh @@ -52,14 +52,12 @@ function find_config_info () {  function del_samba_share () {          volname=$1 -        cp ${CONFIGFILE} /tmp/smb.conf -        sed -i "/gluster-$volname/,/^$/d" /tmp/smb.conf &&\ -                cp /tmp/smb.conf ${CONFIGFILE} +        sed -i "/\[gluster-$volname\]/,/^$/d" ${CONFIGFILE}  }  function sighup_samba () {          pid=`cat ${PIDDIR}/smbd.pid` -        if [ $pid != "" ] +        if [ "x$pid" != "x" ]          then                  kill -HUP $pid;          else  | 
