LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem starting java service during bootup (https://www.linuxquestions.org/questions/linux-newbie-8/problem-starting-java-service-during-bootup-43303/)

TomCruise2002 01-29-2003 09:44 PM

Problem starting java service during bootup
 
:Pengy:
I have written a script which is supposed to start a java sockets listener service during bootup and stop it during shutdown.
See below.

I have placed the script inside /etc/rc.d/init.d and created two soft-linked files in /etc/rc.d/rc5.d so that when redhat linux boots up it will start the script.

After the system has booted up, and I do a ps -ef the java service appears in the list. The strange thing is that when the client program is started it can connect to the server (you don't get a cannot connect to host exception) but it hangs there.

Now if I login to the Linux machine and open a bash shell and stop and start the script again. The programs work perfectly. I am thinking that some other daemons are getting in the way.

I have attached the console for ps-ef for both cases.

Here is the ps -ef after the system boots and the program does not work

UID PID PPID C STIME TTY TIME CMD
root 1 0 2 12:09 ? 00:00:03 init [5]
root 2 1 0 12:09 ? 00:00:00 [keventd]
root 3 1 0 12:09 ? 00:00:00 [kapm-idled]
root 4 0 0 12:09 ? 00:00:00 [ksoftirqd_CPU0]
root 5 0 0 12:09 ? 00:00:00 [kswapd]
root 6 0 0 12:09 ? 00:00:00 [kreclaimd]
root 7 0 0 12:09 ? 00:00:00 [bdflush]
root 8 0 0 12:09 ? 00:00:00 [kupdated]
root 9 1 0 12:09 ? 00:00:00 [mdrecoveryd]
root 412 1 0 12:09 ? 00:00:00 [eth0]
root 413 1 0 12:09 ? 00:00:00 /sbin/dhcpcd -n -R eth0
root 483 1 0 12:09 ? 00:00:00 syslogd -m 0
root 488 1 0 12:09 ? 00:00:00 klogd -2
rpc 508 1 0 12:09 ? 00:00:00 portmap
ntp 658 1 0 12:09 ? 00:00:00 ntpd -U ntp
root 677 1 0 12:09 ? 00:00:00 /usr/sbin/sshd
postgres 738 1 0 12:09 ? 00:00:00 /usr/bin/postmaster -i
postgres 740 738 0 12:09 ? 00:00:00 postgres: stats buffer process
postgres 741 740 0 12:09 ? 00:00:00 postgres: stats collector proces
root 748 1 0 12:09 ? 00:00:00 java KT.ServerMain
root 752 1 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 785 1 0 12:09 ? 00:00:00 xinetd -stayalive -reuse -pidfil
root 786 752 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 787 748 0 12:09 ? 00:00:00 java KT.ServerMain
root 788 787 0 12:09 ? 00:00:01 java KT.ServerMain
root 789 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 790 787 0 12:09 ? 00:00:00 java KT.ServerMain
root 791 787 0 12:09 ? 00:00:00 java KT.ServerMain
root 792 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 793 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 794 787 0 12:09 ? 00:00:00 java KT.ServerMain
root 795 787 0 12:09 ? 00:00:00 java KT.ServerMain
root 796 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 797 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 798 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
root 799 787 0 12:09 ? 00:00:00 java KT.ServerMain
root 800 787 0 12:09 ? 00:00:00 java KT.ServerMain
root 801 786 0 12:09 ? 00:00:00 java KT.ServerMainDownload
lp 825 1 0 12:09 ? 00:00:00 lpd Waiting
root 844 1 0 12:09 ? 00:00:00 gpm -t ps/2 -m /dev/mouse
root 862 1 0 12:09 ? 00:00:00 crond
xfs 914 1 0 12:09 ? 00:00:00 xfs -droppriv -daemon
daemon 932 1 0 12:09 ? 00:00:00 /usr/sbin/atd
root 952 1 0 12:09 tty1 00:00:00 /sbin/mingetty tty1
root 953 1 0 12:09 tty2 00:00:00 /sbin/mingetty tty2
root 954 1 0 12:09 tty3 00:00:00 /sbin/mingetty tty3
root 955 1 0 12:09 tty4 00:00:00 /sbin/mingetty tty4
root 956 1 0 12:09 tty5 00:00:00 /sbin/mingetty tty5
root 957 1 0 12:09 tty6 00:00:00 /sbin/mingetty tty6
root 958 1 0 12:09 ? 00:00:00 /usr/bin/gdm -nodaemon
root 966 958 0 12:09 ? 00:00:00 /usr/bin/gdm -nodaemon
root 967 966 1 12:09 ? 00:00:02 /etc/X11/X :0 -auth /var/gdm/:0.
gdm 973 966 0 12:09 ? 00:00:00 /usr/bin/gdmlogin --disable-soun
gdm 974 973 0 12:09 ? 00:00:00 /usr/bin/xsri --redhat-login --r
root 980 677 0 12:10 ? 00:00:00 /usr/sbin/sshd
506 981 980 0 12:10 pts/0 00:00:00 -bash
root 1035 787 28 12:12 ? 00:00:05 java KT.ServerMain
root 1036 787 1 12:12 ? 00:00:00 java KT.ServerMain
root 1037 787 16 12:12 ? 00:00:03 java KT.ServerMain
root 4725 1037 0 12:12 ? 00:00:00 /usr/bin/env
root 4727 787 0 12:12 ? 00:00:00 [java]
506 4731 981 0 12:12 pts/0 00:00:00 ps -ef
root 4738 1037 0 12:12 ? 00:00:00 /usr/bin/env


Here is the ps -ef when the program works

UID PID PPID C STIME TTY TIME CMD
root 1 0 1 12:09 ? 00:00:03 init [5]
root 2 1 0 12:09 ? 00:00:00 [keventd]
root 3 1 0 12:09 ? 00:00:00 [kapm-idled]
root 4 0 0 12:09 ? 00:00:00 [ksoftirqd_CPU0]
root 5 0 0 12:09 ? 00:00:00 [kswapd]
root 6 0 0 12:09 ? 00:00:00 [kreclaimd]
root 7 0 0 12:09 ? 00:00:00 [bdflush]
root 8 0 0 12:09 ? 00:00:00 [kupdated]
root 9 1 0 12:09 ? 00:00:00 [mdrecoveryd]
root 412 1 0 12:09 ? 00:00:00 [eth0]
root 413 1 0 12:09 ? 00:00:00 /sbin/dhcpcd -n -R eth0
root 483 1 0 12:09 ? 00:00:00 syslogd -m 0
root 488 1 0 12:09 ? 00:00:00 klogd -2
rpc 508 1 0 12:09 ? 00:00:00 portmap
ntp 658 1 0 12:09 ? 00:00:00 ntpd -U ntp
root 677 1 0 12:09 ? 00:00:00 /usr/sbin/sshd
root 785 1 0 12:09 ? 00:00:00 xinetd -stayalive -reuse -pidfil
lp 825 1 0 12:09 ? 00:00:00 lpd Waiting
root 844 1 0 12:09 ? 00:00:00 gpm -t ps/2 -m /dev/mouse
root 862 1 0 12:09 ? 00:00:00 crond
xfs 914 1 0 12:09 ? 00:00:00 xfs -droppriv -daemon
daemon 932 1 0 12:09 ? 00:00:00 /usr/sbin/atd
root 952 1 0 12:09 tty1 00:00:00 /sbin/mingetty tty1
root 953 1 0 12:09 tty2 00:00:00 /sbin/mingetty tty2
root 954 1 0 12:09 tty3 00:00:00 /sbin/mingetty tty3
root 955 1 0 12:09 tty4 00:00:00 /sbin/mingetty tty4
root 956 1 0 12:09 tty5 00:00:00 /sbin/mingetty tty5
root 957 1 0 12:09 tty6 00:00:00 /sbin/mingetty tty6
root 958 1 0 12:09 ? 00:00:00 /usr/bin/gdm -nodaemon
root 966 958 0 12:09 ? 00:00:00 /usr/bin/gdm -nodaemon
root 967 966 0 12:09 ? 00:00:02 /etc/X11/X :0 -auth /var/gdm/:0.
gdm 973 966 0 12:09 ? 00:00:00 /usr/bin/gdmlogin --disable-soun
gdm 974 973 0 12:09 ? 00:00:00 /usr/bin/xsri --redhat-login --r
root 980 677 0 12:10 ? 00:00:00 /usr/sbin/sshd
506 981 980 0 12:10 pts/0 00:00:00 -bash
root 11624 981 0 12:13 pts/0 00:00:00 su root
root 12051 11624 0 12:13 pts/0 00:00:00 bash
postgres 14029 1 0 12:13 pts/0 00:00:00 /usr/bin/postmaster -i
postgres 14031 14029 0 12:13 pts/0 00:00:00 postgres: stats buffer process
postgres 14033 14031 0 12:13 pts/0 00:00:00 postgres: stats collector proces
root 14039 1 2 12:13 pts/0 00:00:00 java KT.ServerMain
root 14043 1 3 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14047 14039 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14048 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14049 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14050 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14051 14043 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14052 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14053 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14054 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14055 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14056 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14057 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14058 14047 0 12:13 pts/0 00:00:00 java KT.ServerMain
root 14059 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14060 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14061 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14062 14051 0 12:13 pts/0 00:00:00 java KT.ServerMainDownload
root 14067 12051 0 12:13 pts/0 00:00:00 ps -ef


All times are GMT -5. The time now is 10:31 AM.