From owner-freebsd-questions Fri May 4 11:23:12 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-26-235-186.mmcable.com [65.26.235.186]) by hub.freebsd.org (Postfix) with SMTP id 3893837B424 for ; Fri, 4 May 2001 11:23:09 -0700 (PDT) (envelope-from mwm@mired.org) Received: (qmail 12694 invoked by uid 100); 4 May 2001 18:23:08 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15090.62348.655622.15519@guru.mired.org> Date: Fri, 4 May 2001 13:23:08 -0500 To: "Educatee" Cc: questions@freebsd.org Subject: Re: How to make a script recognized "stop" In-Reply-To: <114228913@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Educatee types: > I have put a few line to run http-gw in a script file http-gw.sh: > > ------------------- > #!/bin/sh > /usr/local/libexec/http-gw -daemon 3210 > echo -n 'http-gw started ok' > ------------------- > > How could I make it recognized the stop signal. As everytime when I reboot > my machine using > > shutdown -r now > > I was prompt that this script does not recognized the stop and was > recommended to do so. Can you please help me? Thanks. The skeleton to use is: case $1 in start) # Code to run at system startup time. ;; stop) # Code to run at system shutdown time ;; *) echo "usage: `basename $0` (start|stop)" >&2 exit 64 ;; esac > By the way, I am very new to FreeBSD and will like to learn how to write > script. Can you please recommend some URL or books. Thanks. Well, I like the K&P's "Unix Programming Environment", but it's a bit dated. -- Mike Meyer http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message