startup scripts (rc3.d)

I've created the following link in order to startup apache tomcat on startup, however, it does not seem to run. Am I missing something out?

:confused:

/etc/init.d
lrwxrwxrwx 1 root root 16 Sep 5 14:59 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx 1 root root 16 Sep 11 13:09 S100tomcat -> ../init.d/tomcat
drwxr-xr-x 2 root root 4096 Sep 11 13:09 .
[root@mrsdev02 rc3.d]# pwd
/etc/rc.d/rc3.d
[root@mrsdev02 rc3.d]#

/etc/init.d
-rwxr-xr-x 1 root root 276 Sep 12 08:16 tomcat
drwxr-xr-x 2 root root 4096 Sep 12 08:16 .
[root@mrsdev02 init.d]# pwd
/etc/init.d

tomcat startup script //this runs when running it manually
[root@mrsdev02 init.d]# cat tomcat
#!/bin/sh
#export CATALINA_OPTS="-server -Xmx512m"
export CATALINA_HOME=/opt/apache-tomcat-5.5.12
case $1 in
start)
$CATALINA_HOME/bin/startup.sh
;;
stop)
$CATALINA_HOME/bin/shutdown.sh
;;
restart)
$CATALINA_HOME/bin/shutdown.sh
$CATALINA_HOME/bin/startup.sh
;;
esac
exit 0
[root@mrsdev02 init.d]#

You should use S99tomcat rather than S100tomcat; only 2 digits are expected. Not sure this is your problem though....

The problem is that S99 is already in use by another script.

That's not a problem, the numbers aren't exclusive. It just means that those services will be started at the same time... if you need that service to be started before tomcat, you'll need to change it to 98 or earlier.

I've updated the symbolic link, but the process does not boot up either:
lrwxrwxrwx 1 root root 19 Sep 3 14:08 S99firstboot -> ../init.d/firstboot
lrwxrwxrwx 1 root root 11 Sep 3 17:34 S99local -> ../rc.local
lrwxrwxrwx 1 root root 16 Sep 3 14:08 S99smartd -> ../init.d/smartd
lrwxrwxrwx 1 root root 16 Sep 12 14:35 S99tomcat -> ../init.d/tomcat

I think I still have to configure it as a valid service within chkconfig, any idea how to do it please?

tomcat script
-------------
#!/bin/sh
#export CATALINA_OPTS="-server -Xmx512m"

export CATALINA_HOME=/opt/apache-tomcat-5.5.12
case $1 in
start)
cd $CATALINA_HOME/bin/
./startup.sh
;;
stop)
cd $CATALINA_HOME/bin/
./shutdown.sh
;;
restart)
cd $CATALINA_HOME/bin
./shutdown.sh
sleep 10
cd $CATALINA_HOME/bin
./startup.sh
;;
esac
exit 0

chkconfig is a nice-to-have, not a necessity. It's easy to configure by just adding the headers to your /etc/init.d/tomcat script (copy them from another service and modify them) and then chkconfig --add tomcat.

You may find that your server isn't actually booting to runlevel 3, maybe it's going to 5 (with graphical login)? who -r or runlevel should tell you the current runlevel, and grep initdefault /etc/inittab the boot-time default.