Date: Mon, 14 Jun 1999 20:16:33 +0800 From: Gong Wei <ccegongw@nus.edu.sg> To: "'freebsd-questions@freebsd.org'" <freebsd-questions@freebsd.org> Cc: "'freebsd-stable@freebsd.org'" <freebsd-stable@freebsd.org> Subject: RE: *BSD init scripts Message-ID: <762388C091FAD01180FF00A024621378E8EF04@exs01.ex.nus.edu.sg>
next in thread | raw e-mail | index | archive | help
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-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?762388C091FAD01180FF00A024621378E8EF04>