From 2e21bc3f74ba62413bf6826f08cf5a296e00cf4c Mon Sep 17 00:00:00 2001 From: Tom Mortensen Date: Fri, 14 Nov 2025 13:42:39 -0800 Subject: [PATCH] Fix: when stopping Samba, terminate master smbd process first --- etc/rc.d/rc.samba | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/rc.d/rc.samba b/etc/rc.d/rc.samba index 8d30144f8..06e494a5d 100755 --- a/etc/rc.d/rc.samba +++ b/etc/rc.d/rc.samba @@ -155,12 +155,17 @@ samba_stop(){ REPLY="Already stopped" else REPLY="Stopped" + # stop gracefully with SIGTERM the "master" smbd process first + master=$(ps -o pid=,ppid= -C smbd | awk '$2==1 {print $1}') + [[ -n "master" ]] && run kill "$master" + sleep 1 # stop gracefully with SIGTERM run killall --ns $$ smbd nmbd wsdd2 winbindd samba_waitfor_shutdown if samba_running; then REPLY="Killed" # stop forcibly with SIGKILL + [[ -n "master" ]] && run kill -SIGKILL "master" run killall --ns $$ -SIGKILL smbd nmbd wsdd2 winbindd samba_waitfor_shutdown fi