diff options
Diffstat (limited to 'extras/hook-scripts/S30samba-stop.sh')
| -rwxr-xr-x | extras/hook-scripts/S30samba-stop.sh | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/extras/hook-scripts/S30samba-stop.sh b/extras/hook-scripts/S30samba-stop.sh index def87e00e..8950eea43 100755 --- a/extras/hook-scripts/S30samba-stop.sh +++ b/extras/hook-scripts/S30samba-stop.sh @@ -18,6 +18,8 @@ PROGNAME="Ssamba-stop" OPTSPEC="volname:" VOL= +CONFIGFILE= +PIDDIR= function parse_args () { ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@) @@ -38,16 +40,24 @@ function parse_args () { done } +function find_config_info () { + cmdout=`smbd -b | grep smb.conf` + if [ $? -ne 0 ];then + echo "Samba is not installed" + exit 1 + fi + CONFIGFILE=`echo $cmdout | awk {'print $2'}` + PIDDIR=`smbd -b | grep PIDDIR | awk {'print $2'}` +} + 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" ${CONFIGFILE} } function sighup_samba () { - pid=`cat /var/run/smbd.pid` - if [ $pid != "" ] + pid=`cat ${PIDDIR}/smbd.pid` + if [ "x$pid" != "x" ] then kill -HUP $pid; else @@ -56,5 +66,6 @@ function sighup_samba () { } parse_args $@ +find_config_info del_samba_share $VOL sighup_samba |
