Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
If your profile is setting a variable called $catalina_home, and that variable is being expected by the startup programs, then that means you need to set that variable in your startup scripts.
my profile has catalina_home set to
echo $CATALINA_HOME
/usr/local/apache-tomcat-7.0.8
and my sustart.sh file in init.d has a few lines of code
# Get standard Java environment variables
if $os400; then
# -r will Only work on the os400 if the files are:
# 1. owned by the user
# 2. owned by the PRIMARY group of the user
# this will not work if the user belongs in secondary groups
BASEDIR="$CATALINA_HOME"
. "$CATALINA_HOME"/bin/setclasspath.sh
else
if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
BASEDIR="$CATALINA_HOME"
. "$CATALINA_HOME"/bin/setclasspath.sh
else
echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
echo "This file is needed to run this program"
exit 1
fi
Error I get is
# /sbin/service sustart start
Cannot find /etc/bin/setclasspath.sh
This file is needed to run this program
I guess there should be some scripting that set the CATALINA_HOME.This a copy of Catalina.sh that comes with apache-tomcat version.
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$PRG"`
# Only set CATALINA_HOME if not already set
[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=
SETENVPATH="${CATALINA_BASE:-$CATALINA_HOME}"
if [ -r "$SETENVPATH/bin/setenv.sh" ]; then
. "$SETENVPATH/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
[ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
[ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"`
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For OS400
if $os400; then
# Set job priority to standard for interactive (interactive - 6) by using
# the interactive priority - 6, the helper threads that respond to requests
# will be running at the same priority as interactive jobs.
COMMAND='chgjob job('$JOBNAME') runpty(6)'
system $COMMAND
# Enable multi threading
export QIBM_MULTI_THREADED=Y
fi
# Get standard Java environment variables
if $os400; then
# -r will Only work on the os400 if the files are:
# 1. owned by the user
# 2. owned by the PRIMARY group of the user
# this will not work if the user belongs in secondary groups
BASEDIR="$CATALINA_HOME"
. "$CATALINA_HOME"/bin/setclasspath.sh
else
if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
BASEDIR="$CATALINA_HOME"
. "$CATALINA_HOME"/bin/setclasspath.sh
else
echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
echo "This file is needed to run this program"
exit 1
fi
fi
I don't know if the catalina_home is set.I can say that it way beyond my skills.Could you help me in getting the code to set catalina_home
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
/bin/su tomcat $CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
/bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL
----------------------- end of /etc/init.d/tomcat ----------------------
You should be able to modify this for your paths, drop it into /etc/rc.d/init.d, make it executable, and link to it form your rc?.d ( rc5.d if your default init level is 5 ) to make it execute on boot.
Note that it sets the CATALINA_HOME and calls scripts form there IN PLACE. This is what earlier advice referenced.
I hope this makes things clear.
I'd that on rc.local as /path/to/dir/Bin/rmserver rmserver.cfg and in inittab as rmsr:5:respawn:Bin/rmserver rmserver.cfg.
Here is the thing I found in the documentation.
To start the Server
1. Start any command shell.
2. Navigate to the main Server or Proxy installation directory.
3. Choose one of the following options:
a. Start the server or proxy as a background process. Use the following command for Server: Bin/rmserver rmserver.cfg &
......
You should not assume a current location for the startup scripts. You CANNOT assume a location for the support files for non-system scripts.
Your startup for rmserver might look like this
/path/to/dir/Bin/rmserver /path/to/dir/etc/rmserver.cfg
That is why so many system config files are directly or one level under /etc. It makes it short and easy to specify, and is convenient to hard-code as a default.
I believe that it is not starting because it is not finding your cfg file. (Though you should also check the binary and make sure execute permission is set.)
I used to same script for running tomcat instance.It worked for the first time.But, after making some changes like access permissions to the tomcat directory and removing the option "/bin/su user" in the file it doesn't start on boot.
I tried adding chkconfig: 35 71 29 and chkconfig --add servicename and then deleted and recreated the same file as the link says but still couldn't manage to get that working. When I manually run the script using ./filename start,it works well.However,I want it to start itself on boot.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.