I have found and tried some startup scripts online and added them to
/etc/init.d as tomcat, so /etc/init.d/tomcat

I ran chmod a+x tomcat on the script and then chkconfig --add tomcat

chkconfig --list shows tomcat in the list

I have modified the script to have the proper location for my tomcat
installation.

When I try to run /etc/init.d/tomcat restart or /sbin/service tomcat restart
(or stop or start) I get this error:

-bash: /etc/init.d/tomcat: /bin/bash^M: bad interpreter: No such file or
directory

Any help would be great! I just need this to start as a service.

Here is the script I've been trying:

#!/bin/bash
#
# Init file for SixSigns Tomcat server
#
# chkconfig: 2345 55 25
# description: SixSigns Tomcat server
#

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

RUN_AS_USER=root # Adjust run user here
CATALINA_HOME=/work/tomcat/apache-tomcat-6.0.20

start() {
        echo "Starting Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/startup.sh"
        else
          $CATALINA_HOME/bin/startup.sh
        fi
        echo "done."
}
stop() {
        echo "Shutting down Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/shutdown.sh"
        else
          $CATALINA_HOME/bin/shutdown.sh
        fi
        echo "done."
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        #echo "Hard killing any remaining threads.."
        #kill -9 `cat $CATALINA_HOME/work/catalina.pid`
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac

exit 0
-- 
View this message in context: 
http://www.nabble.com/Tomcat-startup-as-service-on-CentOS-5.3-tp24203574p24203574.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to