can rc3.d shutdown use TCP/IP?

  • Follow


I have  Java based process that is started in rc3.d. During shutdown I
want to gracefully shut it down (i.e. not just kill the JVM). It has a
shutdown script that makes it shutdown gracefully by connecting to its
TCP/IP socket and asking it to shutdown. However, can I do that during
shutdown? Is the TCP layer already gone by the time my rc3.d scipts
gets called? I'm noticing that the shutdown doesn't seem to be graceful
during a restart of the OS as indicicated by the processes logs. It
does show a graceful shutdown if I execute the rc3.d stop script by
hand (not during shutdown).

So, can an rc3.d script expect to use the TCP layer to issue a shutdown
to a proprietary process?

-Robert

0
Reply N7093v (29) 12/14/2006 12:59:08 AM

On Wed, 13 Dec 2006, Robert M. Gary wrote:

> So, can an rc3.d script expect to use the TCP layer to issue a shutdown
> to a proprietary process?

I don't know; possibly.  But the usual way to accomplish this
sort of thing is to use a signal.

-- 
Rich Teer, SCNA, SCSA, SCSECA, OpenSolaris CAB member

                                                    .  *   * . * .* .
                                                     .   *   .   .*
President,                                          * .  . /\ ( .  . *
Rite Online Inc.                                     . .  / .\   . * .
                                                    .*.  / *  \  . .
                                                      . /*   o \     .
Voice: +1 (250) 979-1638                            *   '''||'''   .
URL: http://www.rite-group.com/rich                 ******************
0
Reply Rich 12/14/2006 1:29:01 AM


Rich Teer wrote:
> On Wed, 13 Dec 2006, Robert M. Gary wrote:
>
> > So, can an rc3.d script expect to use the TCP layer to issue a shutdown
> > to a proprietary process?
>
> I don't know; possibly.  But the usual way to accomplish this
> sort of thing is to use a signal.

Unfortunately, I can't catch a signal in Java to exit gracefully.

-Robert

0
Reply Robert 12/14/2006 1:48:03 AM

In article <1166057948.110919.143560@l12g2000cwl.googlegroups.com>,
Robert M. Gary <N7093v@gmail.com> wrote:
>I have  Java based process that is started in rc3.d. During shutdown I
>want to gracefully shut it down (i.e. not just kill the JVM). It has a
>shutdown script that makes it shutdown gracefully by connecting to its
>TCP/IP socket and asking it to shutdown. However, can I do that during
>shutdown?

Yes.

>Is the TCP layer already gone by the time my rc3.d scipts
>gets called?

No.

# cat /etc/init.d/test
#!/bin/sh
case "$1" in
    'stop')
	/usr/sfw/bin/wget -O/var/tmp/sun.html http://www.sun.com/
	;;
esac
# (cd /etc/rc3.d; ln -s ../init.d/test K00test)
# init 6
# ls -l /var/tmp/sun.html 
-rw-r--r--   1 root     root       38579 Dec 13 22:58 /var/tmp/sun.html

>I'm noticing that the shutdown doesn't seem to be graceful

If you sleep(1) in your shutdown rc script, does the daemon gracefully
die?

John
groenveld@acm.org
0
Reply groenvel 12/14/2006 4:04:48 AM

John D Groenveld wrote:
>> If you sleep(1) in your shutdown rc script, does the daemon gracefully
> die?

Awesome! I'll give that a try!
-Robert

0
Reply Robert 12/14/2006 4:22:00 AM

4 Replies
135 Views

(page loaded in 0.089 seconds)

Similiar Articles:













7/28/2012 3:56:29 AM


Reply: