When the solaris version of the smb init script is run with the "stop" argument, it works but exits with a nonzero exit code. This happens because it runs /usr/bin/ps and greps for the smbd process, but since there are now 2 processes, the code (which looks to expect only 1 process) kills both the parent and child process. However, killing the parent kills the child, so when /usr/bin/kill gets to the child pid, it is no longer running, so it returns an error code and prints "No such process". To fix this, you can run the /usr/bin/ps command through sort -nr and head -1 and/or consider using the PID files.
the "sort -nr" way is *bad* because after a overrun of the pid table the child processes will have lower pids than the parent process.
Proposed patch: --- samba.init.master.dist 2005-07-28 22:19:54.000000000 +0900 +++ samba.init.master 2008-01-15 15:00:08.000000000 +0900 @@ -11,9 +11,7 @@ fi killproc() { # kill the named process(es) - pid=`/usr/bin/ps -e | - /usr/bin/grep -w $1 | - /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` + pid=`/usr/bin/pgrep -x -P 1 $1` [ "$pid" != "" ] && kill $pid }
Created attachment 3547 [details] Fix this bug and support Solaris zones
Created attachment 3925 [details] Revised patch
there are no solaris init scripts bundled with samba upstream any more and Solaris uses svc since Solaris 10 anyway now (which is kind of the grown up role model of systemd). We leave it up to the distributions to make those though now.