trying to right a startup script

trying to right a startup script

Post by Andrew Armstron » Wed, 19 Feb 2003 19:58:29



I am trying to write a start-up script which starts two Java applications. I
have created a script in /etc/init.d and created a symbolic link to it from
/etc/rc3.d. When I reboot I get 6 instances of the java application
'j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c' as show
below, I only want one. Can anyone tell me what I am doing wrong. I have
included the script below also for your information.

Any help would be very much appreciated

Andrew

ps
---------------------------

PID  Uid     Stat Command
    1 root     S    init [
    2 root     S    [keventd]
    3 root     S    [ksoftirqd_CPU0]
    4 root     S    [kswapd]
    5 root     S    [bdflush]
    6 root     S    [kupdated]
    8 root     S    [mtdblockd]
   30 root     S    [jffs2_gcd_mtd1]
   65 root     S    /sbin/syslogd -p /var/run/log
   68 root     S    /sbin/klogd
   75 root     S    /usr/sbin/inetd
   79 root     S
   j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c
   83 nobody   S    /usr/sbin/thttpd -C /etc/thttpd.conf
   87 root     S
   j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c
   88 root     S
   j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c
   89 root     S
   j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c
   90 root     S
   j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c
   91 root     S
   j9 -bp:/opt/wsdd4.0/lib/classes.zip:/opt/wsdd4.0/lib/rmi.zip c
   92 root     S    /usr/sbin/sshd
   93 root     S    /sbin/getty 38400 tty1
   94 root     S    /sbin/getty 38400 tty2
   95 root     S    /sbin/getty -L ttyS0 115200 vt100
   97 root     S    in.telnetd: wordsworth
   98 arcom    S    -sh
   99 arcom    R    ps

-------
startup script
-------

#!/bin/sh
#Configure ATE Test Node

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/wsdd4
.0/bin
LD_LIBRARY_PATH=/opt/wsdd4.0/lib:/opt/wsdd4.0/bin
J9BOOTPATH="/opt/wsdd4.0/lib"
PIDFILE=/var/run/rmi.pid
export LD_LIBRARY_PATH

insmod /home/arcom/bin/custom_driver1.o
insmod /home/arcom/bin/custom_driver2.o

case "$1" in
        start)
                if [ ! -e $PIDFILE ]; then
                        echo 3747 > $PIDFILE
                        echo "starting RMI registry"
                        j9 -bp:$J9BOOTPATH/classes.zip:$J9BOOTPATH/rmi.zip
com.ibm.oti.rmi.registry.Main &
                        sleep 1
                fi
;;

esac

exit 0

 
 
 

trying to right a startup script

Post by Chris Lowt » Wed, 19 Feb 2003 23:44:15



> Can anyone tell me what I am doing wrong.

Nothing! It's working.

Java can use multiple processes (depending on what you are asking it to do)
- so I think it's probably fine. Just in case I'm wrong, can you give us a
more detailed "ps" output (with the PPID as well as the PID shown).

"ps -A xf" Would be nice - you'll probably see that all your java processes
are children of one father java process (which is good news, if so).

Chris

--
My real e-mail address is
chris <at> lowth <dot> com