From owner-freebsd-stable Mon Jun 14 5:16:36 1999 Delivered-To: freebsd-stable@freebsd.org Received: from imc01.ex.nus.edu.sg (imc01.ex.nus.edu.sg [137.132.14.60]) by hub.freebsd.org (Postfix) with ESMTP id 4D27214C18; Mon, 14 Jun 1999 05:16:30 -0700 (PDT) (envelope-from ccegongw@nus.edu.sg) Received: by imc01.ex.nus.edu.sg with Internet Mail Service (5.5.2448.0) id ; Mon, 14 Jun 1999 20:16:36 +0800 Message-ID: <762388C091FAD01180FF00A024621378E8EF04@exs01.ex.nus.edu.sg> From: Gong Wei To: "'freebsd-questions@freebsd.org'" Cc: "'freebsd-stable@freebsd.org'" Subject: RE: *BSD init scripts Date: Mon, 14 Jun 1999 20:16:33 +0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="ISO-8859-1" Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi all, So far I have received a few replies from the list, first of all thank you all for your time! Probably I didn't phase my question correctly. Here let me try again. I am looking for a customizable script that init will call upon shutting down and/or rebooting, *BEFORE* sending TERM signal to running processes. In SysV world(Sorry for this as all along I was using SysV variant like Linux/Solaris) there is something called runlevel. So rebooting is actually going to run level 6 whereas shutting down (halt) is going to runlevel 0. This process will call all K* scripts in the corresponding directory with a "stop" argument. Then it will send TERM signal (15) to all running process. Someone suggested me to change the script to accept one possible argument "start" and/or "stop" and react accordingly. That is really not an issue at all, the issue is whether the script will ever be called with a "stop" argument or not. I know that on 3.2-RELEASE, all /usr/local/etc/rc.d/*.sh will always be called with a "start" argument upon startup, but what about shutting down/reboot? Someone also suggested to modify the daemon source code to install a signal handler which is really overkill in this case. In fact what I want to do is faily simple: ================================================== case "$1" in start) mv /etc/somefilea /etc/somefileb somedir/smbd -D somedir/nmbd -D ;; stop) mv /etc/somefileb /etc/somefileb kill `cat anotherdir/nmbd.pid` kill `cat anotherdir/smbd.pid` ;; *) echo "Usage: xxxxx" exit 1 esac ================================ I hope I expressed myself clearly this time :-) -----Original Message----- From: Gong Wei [mailto:ccegongw@nus.edu.sg] Sent: Monday, June 14, 1999 8:35 AM To: 'freebsd-questions@freebsd.org' Cc: 'freebsd-stable@freebsd.org' Subject: *BSD init scripts Hi, I have a special requirement for starting and shutting down a particular daemon. For starting up no problem, I can create a file abc.sh in /usr/local/etc/rc.d. But what about shutting down the daemon? It cannot be simply killed by -15 or -9. Some custom action must be taken place before the daemon got killed. Is there any way to achieve this? I tried to put in some instructions in /etc/rc.shutdown, but it seems that this script (rc.shutdown) didn't get called at all if I use reboot/shutdown -r now/shutdown -h now/halt to stop the system. However, if I press Ctl-Alt-Del this script did get called. I am using Release 3.2 on Intel platform, if this matters. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message