Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i think you saved the file in msdos format, if you open the file in vi you'll probably see ^M's at the end of each line, which (afair) is the linefeed character which is used in dos format but not unix format.
i think you saved the file in msdos format, if you open the file in vi you'll probably see ^M's at the end of each line, which (afair) is the linefeed character which is used in dos format but not unix format.
Hi ya,
I have typed it now in vi editor by removing the previous one but getting the same error. "-bash: /etc/init.d/tomcat: /bin/sh^M: bad interpreter: No such file or directory." Even i replaced /bin/bash to /bin/sh but it didnt work and the same error "bash: /etc/init.d/tomcat: /bin/bash^M: bad interpreter: No such file or directory."
You can always use dos2unix to convert a file from msdos to unix format. For details:
Code:
man dos2unix
Regards
Hi
I used the same command dos2unix /etc/rc.d/tomcat,
but still getting the same error "-bash: /etc/init.d/tomcat: /bin/sh^M: bad interpreter: No such file or directory." Even i replaced /bin/bash to /bin/sh but it didnt work and the same error "bash: /etc/init.d/tomcat: /bin/bash^M: bad interpreter: No such file or directory."
I cannot figure out what happens with your script. I've tested in my system and ti works. Can you try the following much simpler script to see if it works (change JAVA_HOME if needed)?
Code:
#!/bin/sh
# Tomcat Startup Script
export CATALINA_HOME=/opt/tomcat
export JAVA_HOME=/usr/java
export TOMCAT_OWNER=tomcat
start() {
echo -n "Starting Tomcat: "
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh
}
stop() {
echo -n "Stopping Tomcat: "
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: tomcat {start|stop|restart}"
exit
esac
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.