--- a/etc/init.d/samba-ad-dc 2024-03-05 13:13:26.000000000 +0100 +++ b/etc/init.d/samba-ad-dc 2024-05-28 23:10:16.815642938 +0200 @@ -77,9 +77,14 @@ log_daemon_msg "Stopping $DESC" $NAME ## sometimes samba takes a long time to terminate, ## which would make starting new samba processes fail. - pids=$(pgrep -F "$PIDFILE"; pgrep --exact '(smbd|winbindd)') + pid_samba=$(pgrep -F "$PIDFILE") + pid_smbd=$(pgrep --exact 'smbd') + pid_winbindd=$(pgrep --exact 'winbindd') start-stop-daemon --stop --quiet --pidfile $PIDFILE --name samba ret="$?" + [ -n "$pid_smbd" ] && start-stop-daemon --stop --quiet --pid $pid_smbd --name smbd + [ -n "$pid_winbindd" ] && start-stop-daemon --stop --quiet --pid $pid_winbindd --name winbindd + pids=$(echo $pid_samba; echo $pid_smbd; echo $pid_winbindd) if [ -n "$pids" ]; then unset pgids kgids for pid in $pids; do