tomcat start script on server linux

Highlighted
Six Stars

tomcat start script on server linux

Hi all,

I would like to start TAC service on server boot automatically.

I get the script from https://help.talend.com/reader/UgiwP5qZ9ufPrulo9_w21w/tgJfOr8oyQA1YBVM_hj2Dg but it contains some errors.

Has someone a correct script to do this?

Below the script inserted in /etc/init.d/

In bold the part that doesn't seem to work

############################################

# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

user=<user>
tomcat=<installation_path>/tac/apache-tomcat/
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
#export JAVA_HOME=/usr/local/java

status(){
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt
read line < /tmp/tomcat_process_count.txt
if [ $line -gt 0 ]; then
echo -n "tomcat ( pid "
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'
echo -n ") is running..."
echo
else
echo "Tomcat is stopped"
fi
}

start(){
echo -n $"Starting Tomcat service: "
#daemon -c
su - $user -c "$startup"
RETVAL=$?
echo
}

stop(){
action $"Stopping Tomcat service: " su - $user "$shutdown"
RETVAL=$?
echo
}

restart(){
stop
start}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)

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

exit 0

Moderator

Re: tomcat start script on server linux

Hello,

What's the server linux version are you using?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: tomcat start script on server linux

Hi,

server linux version is

SUSE Linux Enterprise Server 12 SP3

Regards

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog