Skip to content

Commit b736f9c

Browse files
authored
Merge pull request #2462 from unraid/samba-stop
Fix: when stopping Samba, terminate master smbd process first (again)
2 parents 62a55b9 + 129fd54 commit b736f9c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

etc/rc.d/rc.samba

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,16 @@ samba_stop(){
156156
else
157157
REPLY="Stopped"
158158
# stop gracefully with SIGTERM the "master" smbd process first
159-
master=$(ps -o pid=,ppid= -C smbd | awk '$2==1 {print $1}')
160-
[[ -n "master" ]] && run kill "$master"
159+
master=$(pgrep --ns $$ -o smbd)
160+
[[ -n "$master" ]] && run kill "$master"
161161
sleep 1
162162
# stop gracefully with SIGTERM
163163
run killall --ns $$ smbd nmbd wsdd2 winbindd
164164
samba_waitfor_shutdown
165165
if samba_running; then
166166
REPLY="Killed"
167167
# stop forcibly with SIGKILL
168-
[[ -n "master" ]] && run kill -SIGKILL "master"
168+
[[ -n "$master" ]] && run kill -SIGKILL "$master"
169169
run killall --ns $$ -SIGKILL smbd nmbd wsdd2 winbindd
170170
samba_waitfor_shutdown
171171
fi

0 commit comments

Comments
 (0)