Home

Start Tomcat at boot time in Red Hat

You are here

8 posts / 0 new
Last post
Start Tomcat at boot time in Red Hat

How to start Tomcat at boot time in Red Hat Enterprise 5 ???
Regards !!!!

Re: Start Tomcat at boot time in Red Hat

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 :)

If you have best pratices or find good documentation to do a feature, add a link here : http://wiki.alfresco.com/wiki/How_to

Re: Start Tomcat at boot time in Red Hat


Alfresco Partner of the Year 2012.
www.zaizi.com

** If this post was helpful, please click Yes on the Post Rating --> **

Re: Start Tomcat at boot time in Red Hat

thanks for you collaboration...I'll try these options...regards

Re: Start Tomcat at boot time in Red Hat

If you have best pratices or find good documentation to do a feature, add a link here : http://wiki.alfresco.com/wiki/How_to

Re: Start Tomcat at boot time in Red Hat

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

If you have best pratices or find good documentation to do a feature, add a link here : http://wiki.alfresco.com/wiki/How_to

Re: Start Tomcat at boot time in Red Hat

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

If you have best pratices or find good documentation to do a feature, add a link here : http://wiki.alfresco.com/wiki/How_to

Re: Start Tomcat at boot time in Red Hat

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-run-during-shutdown-reboot-439249/#post3101097

If you have best pratices or find good documentation to do a feature, add a link here : http://wiki.alfresco.com/wiki/How_to

forums index