You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Bahman <ba...@online.no> on 2004/04/29 20:13:53 UTC
daemon!!
Good day all!
Could you please help.
I am trying to run the james as daemon on RedHat 9 Linux. I have the latest
version of the james and found following files to make this daemon happen,
but it simply doesn't!!!!
the go.sh file is placed in the james/bin to run the run.sh
the james file is the file that will be placed in /etc/init.d and links in
the rc3 rc5 folders.
now when you type /etc/init.d/james start
it takes all the necessary steps and says it has started, but when you run
telnet myserver 4555 (or telnet xxx.xxx.xxx.xxx 110) you notice that it
hasn't start the james!!!!
now try typing james/bin/go.sh start
you will see that it works fine.
go.sh
---------
#!/bin/sh
#
# go.sh
# Shell script to start and stop James
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
esac
# Checking for JAVA_HOME is required on *nix
if [ "$JAVA_HOME" = "" ] ; then
export JAVA_HOME=/usr/java/j2sdk1_4_2_03
echo "ERROR: JAVA_HOME not found in your environment."
echo
echo "Please, set the JAVA_HOME variable in your environment to match
the"
echo "location of the Java Virtual Machine you want to use."
echo "Trying to use /usr/java as default"
exit 1
fi
JAVACMD=$JAVA_HOME/bin/java
# resolve links - $0 may be a softlink
THIS_PROG="$0"
while [ -h "$THIS_PROG" ]; do
ls=`ls -ld "$THIS_PROG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
THIS_PROG="$link"
else
THIS_PROG=`dirname "$THIS_PROG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$THIS_PROG"`
PHOENIX_HOME=`cd "$PRGDIR/.." ; pwd`
unset THIS_PROG
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$PHOENIX_HOME" ] && PHOENIX_HOME=`cygpath --unix "$PHOENIX_HOME"`
fi
if [ -z "$PHOENIX_TMPDIR" ] ; then
# Define the java.io.tmpdir to use for Phoenix
PHOENIX_TMPDIR="$PHOENIX_HOME"/temp
mkdir -p "$PHOENIX_TMPDIR"
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
PHOENIX_HOME=`cygpath --path --windows "$PHOENIX_HOME"`
fi
# ----- Execute The Requested
Command -----------------------------------------
echo "Using PHOENIX_HOME: $PHOENIX_HOME"
echo "Using PHOENIX_TMPDIR: $PHOENIX_TMPDIR"
echo "Using JAVA_HOME: $JAVA_HOME"
#
# Command to override JVM ext dir
#
# This is needed as some JVM vendors
# like placing jaxp/jaas/xml-parser jars in ext dir
# thus breaking Phoenix
#
JVM_OPTS="-Djava.ext.dirs=$PHOENIX_HOME/lib"
if [ "$PHOENIX_SECURE" != "false" ] ; then
# Make phoenix run with security manager enabled
JVM_OPTS="$JVM_OPTS -Djava.security.manager"
fi
if [ "$1" = "start" ] ; then
shift
$JAVACMD $JVM_OPTS \
$JVM_OPTS \
-Djava.security.policy=jar:file:$PHOENIX_HOME/bin/phoenix-loader.jar!/
META-INF/java.policy \
$PHOENIX_JVM_OPTS \
-Dphoenix.home="$PHOENIX_HOME" \
-Djava.io.tmpdir="$PHOENIX_TMPDIR" \
-jar "$PHOENIX_HOME/bin/phoenix-loader.jar" $* > /dev/null 2>&1 &
echo $! > /var/run/james.pid
elif [ "$1" = "stop" ] ; then
shift
kill -15 `cat /var/run/james.pid`
rm -rf /var/run/james.pid
elif [ "$1" = "run" ] ; then
shift
$JAVACMD $JVM_OPTS \
$JVM_OPTS \
-Djava.security.policy=jar:file:$PHOENIX_HOME/bin/phoenix-loader.jar!/
META-INF/java.policy \
$PHOENIX_JVM_OPTS \
-Dphoenix.home="$PHOENIX_HOME" \
-Djava.io.tmpdir="$PHOENIX_TMPDIR" \
-jar "$PHOENIX_HOME/bin/phoenix-loader.jar" $* "$@"
else
echo "Usage:"
echo "james (start|run|stop)"
echo " start - start james in the background"
echo " run - start james in the foreground"
echo " stop - stop james"
exit 0
fi
james
----------------
#!/bin/sh
#
# Startup script for James, the Jakarta Mail Server
# Comments to support chkconfig on RedhHat Linux
# chkconfig: 2345 95 15
# Description: James is a Mail Server
# processname: james
# pidfile: /var/run/james.pid
# config: /opt/james/apps/james/conf/config.xml
# logfiles: /opt/james/apps/james/logs
#
# version 1.0 -
#
# Source function library.
. /etc/rc.d/init.d/functions
#SET THE FOLLOWING LINE TO YOUR JAVA_HOME
export JAVA_HOME=/usr/java
#SET THE FOLLOWING LINE TO YOUR CORRECT JBOSS_HOME
export JAMES_HOME=/opt/james
export PATH=$PATH:$JAMES_HOME/bin:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
#IF YOU NEED SPECIAL CLASSES IN YOUR CLASSPATH
#AT STARTUP, ADD THEM TO YOUR CLASSPATH HERE
#export CLASSPATH=
RETVAL=0
# See how we were called.
case "$1" in
start)
cd $JAMES_HOME/bin
echo -n "From ["$JAMES_HOME"/bin/go.sh] Starting james daemon: "
daemon $JAMES_HOME/bin/go.sh start
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/james
;;
stop)
echo -n "Stopping james daemon: "
killproc james
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/james
;;
restart)
echo -n "Restarting james daemon: "
$0 stop
sleep 2
$0 start
;;
*)
# usage
echo "Usage: $0 start|stop|restart"
exit 1
;;
esac
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.670 / Virus Database: 432 - Release Date: 27.04.2004
Re: daemon!!
Posted by trebor iksrazal <ik...@yahoo.com>.
--- Bahman <ba...@online.no> wrote:
> Good day all!
>
> Could you please help.
>
> I am trying to run the james as daemon on RedHat 9
> Linux. I have the latest
> version of the james and found following files to
> make this daemon happen,
> but it simply doesn't!!!!
>
You could try the java services wrapper project, whose
purpose is to run java programs as a windows service
or *nix daemon.
http://wrapper.tanukisoftware.org/doc/english/
HTH,
iksrazal
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
RE: daemon!!
Posted by "Noel J. Bergman" <no...@devtech.com>.
I have not read through your scripts, but ...
> when you type /etc/init.d/james start
You should be using the "service" command, and I hope that you have been
properly using chkconfig.
> it takes all the necessary steps and says it has started
>, but when you run telnet myserver 4555 (or
> telnet xxx.xxx.xxx.xxx 110) you notice that it hasn't
> start the james!!!!
Did you check the logs? Was there an exception reported? Were you root
when you started the process?
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org