components/samba/samba/Solaris/samba.sh
branchs11u1-sru
changeset 2513 8507b46f64f5
parent 878 f5bfc829326f
child 1396 2c75b46fc80a
equal deleted inserted replaced
2511:4a3540719f56 2513:8507b46f64f5
    20 #
    20 #
    21 # CDDL HEADER END
    21 # CDDL HEADER END
    22 #
    22 #
    23 
    23 
    24 #
    24 #
    25 # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
    25 # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
    26 #
    26 #
    27 
    27 
    28 . /lib/svc/share/smf_include.sh
    28 . /lib/svc/share/smf_include.sh
    29 
    29 
    30 SAMBA_CONFIG=/etc/samba/smb.conf
    30 SAMBA_CONFIG=/etc/samba/smb.conf
       
    31 
       
    32 # Check if given service is working properly
       
    33 check_running() {
       
    34 	case "$SMF_FMRI" in
       
    35 		svc:/network/winbind:*)
       
    36 			# It takes some time before winbind starts to really work
       
    37 			# This is infinite loop which will be killed after smf timeout
       
    38 			while : ; do
       
    39 				sleep 2
       
    40 				PING=`/usr/bin/wbinfo --ping-dc 2>&1`
       
    41 				if [ $? -eq 0 ]; then
       
    42 					break
       
    43 				fi
       
    44 				echo "$PING"
       
    45 			done
       
    46 			;;
       
    47 	esac
       
    48 	return 0
       
    49 }
    31 
    50 
    32 case "$1" in
    51 case "$1" in
    33 	start)
    52 	start)
    34 		if [ ! -f "$SAMBA_CONFIG" ]; then
    53 		if [ ! -f "$SAMBA_CONFIG" ]; then
    35 			echo "Configuration file '$SAMBA_CONFIG' does not exist."
    54 			echo "Configuration file '$SAMBA_CONFIG' does not exist."
    37 		fi
    56 		fi
    38 
    57 
    39 		# Command to execute is found in second and further script arguments
    58 		# Command to execute is found in second and further script arguments
    40 		shift
    59 		shift
    41 		eval "$@"
    60 		eval "$@"
       
    61 		check_running
    42 		;;
    62 		;;
    43 	stop)
    63 	stop)
    44 		# kill whole contract group
    64 		# kill whole contract group
    45 
    65 
    46 		# first send TERM signal and wait 30 seconds
    66 		# first send TERM signal and wait 30 seconds