From owner-freebsd-ports Wed Jul 4 9:39:24 2001 Delivered-To: freebsd-ports@freebsd.org Received: from smtp.well.com (smtp.well.com [208.178.101.27]) by hub.freebsd.org (Postfix) with ESMTP id 9764237B403; Wed, 4 Jul 2001 09:39:21 -0700 (PDT) (envelope-from howardjp@well.com) Received: from well.com (howardjp@well.com [208.178.101.2]) by smtp.well.com (8.8.5/8.8.4) with ESMTP id JAA24578; Wed, 4 Jul 2001 09:39:35 -0700 (PDT) Received: from localhost (howardjp@localhost) by well.com (8.8.5/8.8.5) with ESMTP id JAA19399; Wed, 4 Jul 2001 09:39:04 -0700 (PDT) Date: Wed, 4 Jul 2001 09:39:04 -0700 (PDT) From: James Howard To: "David W. Chapman Jr." Cc: freebsd-ports@FreeBSD.org, dwcjr@FreeBSD.org Subject: Re: ports/28643: Improved version of samba.sh.sample that includes restart In-Reply-To: <20010704011745.A11575@leviathan.inethouston.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, 4 Jul 2001, David W. Chapman Jr. wrote: > Patching file samba.sh.sample using Plan A... > Hunk #1 failed at 4. > 1 out of 1 hunks failed--saving rejects to samba.sh.sample.rej > Hmm... Ignoring the trailing garbage. > done > > It does this for both samba ports. Interesting. I took it off to a different FreeBSD system and got the same results. Here is one I tested several places and it works fine. It is the same code, just a new diff. Before this is committed, would it make sense to break out the start and stop code into functions? I have seen some start up scripts do this, but cannot find any right now. --- samba.sh.sample.orig Wed Jul 4 10:43:40 2001 +++ samba.sh.sample Wed Jul 4 10:50:23 2001 @@ -4,20 +4,31 @@ smbd=/usr/local/sbin/smbd nmbd=/usr/local/sbin/nmbd -# start -if [ "x$1" = "x" -o "x$1" = "xstart" ]; then - if [ -f $smbd ]; then - if [ -d $smbspool ]; then - rm -f $smbspool/* - fi - echo -n ' Samba' - $smbd -D - $nmbd -D - fi - -# stop -elif [ "x$1" = "xstop" ]; then - kill `cat $pidfiledir/smbd.pid` - kill `cat $pidfiledir/nmbd.pid` -fi - +case "$1" in + stop) + killall -TERM smbd + killall -TERM nmbd + echo "Samba stopped" + ;; + restart) + killall -TERM smbd + killall -TERM nmbd + if [ -d $smbspool ]; then + rm -f $smbspool/* + fi + $smbd -D + $nmbd -D + echo "Samba restarted" + ;; + -h) + echo "Usage: `basename $0` { start | stop | restart }" + ;; + *) + if [ -d $smbspool ]; then + rm -f $smbspool/* + fi + $smbd -D + $nmbd -D + echo -n ' Samba' + ;; +esac To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message