LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-23-2011, 12:27 PM   #16
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112

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.
 
Old 03-23-2011, 03:58 PM   #17
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
If I properly get your point,

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

Any guess
 
Old 03-23-2011, 04:54 PM   #18
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
It's not even a guess... your script keeps calling $CATALINA_HOME, and you haven't set it, so set it.

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-5.html
 
Old 03-23-2011, 06:56 PM   #19
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
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


Thanks
 
Old 03-24-2011, 11:32 AM   #20
wpeckham
Senior Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 1,653

Rep: Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569
Tomcat

Have you read the TOMCAT user guide?
You should never want to move any cfg files or the catalina scripts into the init.d or rc?.d folders. EVER.

There are examples of startup scripts available, check the TOMCAT forums.

The tomcat startup CAN be added to the APACHE startup script if needed, but the following example of "HOW TO DO IT" is posted online at http://raibledesigns.com/tomcat/boot-howto.html
Quote:
---------------------------- /etc/init.d/tomcat ------------------------
#!/bin/bash
#
# tomcat
#
# chkconfig:
# description: Start up the Tomcat servlet engine.

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


RETVAL=$?
CATALINA_HOME="/usr/apps/apache/tomcat/jakarta-tomcat-4.0.4"

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.
 
1 members found this post helpful.
Old 03-24-2011, 06:41 PM   #21
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
Thanks a lot.Will give a try and let you know the result

And will it be the same for cfg file

I had that in the rc.local as /path/to/dir/Bin/rmserver rmserver.cfg

and in inittab as rmsr:3:respawn:Bin/rmserver rmserver.cfg

However,it doesn't start on boot

Last edited by ansrewdps; 03-24-2011 at 08:28 PM. Reason: thought of asking the other problem as well
 
Old 03-25-2011, 08:43 AM   #22
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
Any suggestions on how to make it run on boot

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 &
......
 
Old 03-25-2011, 11:05 AM   #23
wpeckham
Senior Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 1,653

Rep: Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569
startup

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.)
 
Old 03-25-2011, 02:06 PM   #24
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
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.

Any suggestions
 
Old 03-26-2011, 06:17 PM   #25
ansrewdps
Member
 
Registered: Dec 2010
Posts: 56

Original Poster
Rep: Reputation: 0
rmserver starts on boot,however, problem still exists with tomcat script...
 
Old 03-27-2011, 10:37 AM   #26
wpeckham
Senior Member
 
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 1,653

Rep: Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569
Startup

Think: If it was working, you made changes, it broke ... first step is undo those changes.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: Startup script aloneattack Red Hat 2 03-06-2008 04:01 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 03:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 10:40 PM
startup script rockwell_001 Linux - General 4 04-21-2005 05:22 PM
Startup Script LtcJohnson Linux - Newbie 2 10-26-2004 12:22 AM


All times are GMT -5. The time now is 06:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration