[Bug 254006] net/samba(all versions): rc.d/samba_server stop/restart patch for restart crash

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Mar 4 08:53:11 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254006

--- Comment #1 from Peter Eriksson <pen at lysator.liu.se> ---
Comment on attachment 222968
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=222968
Patch to fix samba_server rc.d script to wait for all processes to die

>--- samba_server.orig	2021-03-04 09:38:24.177530000 +0100
>+++ samba_server	2021-03-04 09:37:48.721550000 +0100
>@@ -126,11 +126,27 @@
> 	rcvar=${name}_enable
> 	command="/usr/local/sbin/${name}"
> 	pidfile="${samba_server_piddir}/${name}.pid"
>+	masterpid=""
>+	if [ "${rc_arg}" = "stop" ] ; then
>+	    masterpid="`cat ${pidfile}`"
>+	fi
>+	
> 	# Daemon should be enabled and running
> 	if ( [ -n "${rcvar}" ] && checkyesno "${rcvar}" ) || [ -n "$force_run" ]; then
> 	    run_rc_command "${_rc_prefix}${rc_arg}" ${rc_extra_args}
> 	    # If any of the commands failed, take it as a global result
> 	    result=$((${result} || $?))
>+
>+	    if [ "${rc_arg}" = "stop" -a "$masterpid" != "" ] ; then
>+		if pgrep -q -s "$masterpid"; then
>+		    echo -n "Waiting for all ${name} subprocesses to terminate..."
>+		    while pgrep -q -s "$masterpid"; do
>+			echo -n "."
>+			sleep 1
>+		    done
>+		    echo ""
>+		fi
>+	    fi
> 	fi
>     done
>     return ${result}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list