> -----Original Message----- > From: tomcatastrophe > Sent: Thursday, June 25, 2009 9:47 > Subject: Tomcat startup as service on CentOS 5.3 > > > 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
Edit in nano Then save / write output When it asks for the name esc-d I think to save as unix line ending. > > 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 > -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org