cancel
Showing results for 
Search instead for 
Did you mean: 

Start Tomcat at boot time in Red Hat

xz2yqb
Champ in-the-making
Champ in-the-making
How to start Tomcat at boot time in Red Hat Enterprise 5 ???
Regards !!!!
7 REPLIES 7

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

As root :

Create : /etc/rc.d/init.d/alfresco

#!/bin/bash
#
# Startup script for the …
#
# Source function library.
. /etc/init.d/functions

PATH=/usr/local/bin:/sbin:/usr/sbin:$PATH
export PATH
# See how we were called.
case "$1" in
  start)
        echo -n "Starting Alfresco: "
        su - alfresco -c '/opt/Alfresco3/alf_start.sh > /dev/null 2>&1 &'
        ;;
  stop)

        ;;
  restart)
        $0 stop
        $0 start
        ;;
  reload)
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0

Start your DB before… perhaps set iptables rules… The redirection "> /dev/null 2>&1 &'" is used to not wait on the start of Alfresco to show the login page.

chmod +x /etc/rc.d/init.d/alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc5.d/S98alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc3.d/S98alfresco

These are symbolic links accessing the alfresco script, rc5 for UI start and rc3 without UI. The number S98 just controls the order in which the scripts are run, have a look inside the directory to see which number you have to write

Good luck Smiley Happy

zaizi
Champ in-the-making
Champ in-the-making

xz2yqb
Champ in-the-making
Champ in-the-making
thanks for you collaboration…I'll try these options…regards

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

I would like to stop Alfresco properly but Mysql go off before and there is problems with the access with the db…

I have put the K…alfresco before K…mysql

/etc/rc.d/init.d/alfresco
#!/bin/bash
#
# Startup script for Alfresco
#
# Source function library.
. /etc/init.d/functions

PATH=/usr/local/bin:/sbin:/usr/sbin:$PATH
export PATH
# See how we were called.
case "$1" in
  start)
        echo -n "Starting Alfresco: "
        su - alfresco -c '/opt/Alfresco/alf_start.sh > /dev/null 2>&1 &'
        ;;
  stop)
        echo -n "Stopping Alfresco…. "     
        su - alfresco -c '/opt/Alfresco/alf_stop.sh'
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  reload)
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac

exit 0

chmod +x /etc/rc.d/init.d/alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc5.d/S98alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc3.d/S98alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc0.d/K02alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc6.d/K02alfresco
ln -s /etc/rc.d/init.d/alfresco /etc/rc.d/rc1.d/K02alfresco

In the rc6.d, mysql is K36mysqld

Why Alfresco is shutdown after mysql ?

Thanks

dranakan
Champ on-the-rise
Champ on-the-rise
The stop is never done when a do a reboot.
In the stop, I have put an echo to a log file  ("echo … >> /var/log/log.log"). If a do "service alfresco stop", the message is written. But if I do a reboot, there no message…
(I have also written a message in the stop of mysql and the message is written with a reboot., it's ok)

My script has bugs… what is wrong  :?:  (reboot doesn't execute the stop)

This command doesn't wait until Alfresco shutdown…
su - alfresco -c '/opt/Alfresco/alf_stop.sh'
Need to add a sleep or like this :
sudo -H -u alfresco sh $CATALINA_HOME/bin/shutdown.sh
killall -w -u alfresco

dranakan
Champ on-the-rise
Champ on-the-rise
it's ok… need to add command in the start script…


case "$1" in
  start)
        touch /var/lock/subsys/alfresco
        echo -n "Starting Alfresco: "


http://www.linuxquestions.org/questions/linux-newbie-8/scripts-under-rc0-d-and-rc6-d-do-not-seem-to-...