Differences between revisions 12 and 13
Revision 12 as of 2008-08-18 21:12:46
Size: 6773
Editor: renen
Comment:
Revision 13 as of 2009-09-20 22:58:36
Size: 6773
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Windows

* Copy %jamesdirhere%\conf\wrapper.conf to %jamesdirhere%\bin\ * Then, from a command line, execute: wrapper.exe -i wrapper.conf

Alternatively leave wrapper.conf where it is and tell wrapper.exe where it is: * %jamesdirhere%\bin\wrapper.exe -i %jamesdirhere%\conf\wrapper.conf

Linux

For Red Hat

Add the following two lines to the start of phoenix.sh to make it chkconfig friendly (phoenix.sh lives in james/bin):

#chkconfig: 2345 80 05
#description: James Mail Server

Then add the following line (also to phoenix.sh) to set the JAVA_HOME value

export JAVA_HOME=/usr/java/j2sdk/

The first three lines of phoenix.sh are now

#chkconfig: 2345 80 05
#description: James Mail Server
export JAVA_HOME=/usr/java/j2sdk/

Add a symbolic link to the james start up script (phoenix.sh)

cd /etc/init.d
ln -s /opt/james-2.3.1/bin/phoenix.sh james

Then, add james as a service

chkconfig --add james

Then, start the service

service james start

And test:

telnet localhost 25

Wrapper Instructions

The wrapper instructions are found at http://wrapper.tanukisoftware.org/doc/english/launch-nix-boot-debian.html

I had to edit phoenix.sh to set the PHOENIX_HOME (somewhere near the top)

PHOENIX_HOME=/home/telrock/apps/james

and comment out the bit of phoenix.sh

 #PRGDIR=`dirname "$THIS_PROG"`
 #PHOENIX_HOME=`cd "$PRGDIR/.." ; pwd`
 #
 #unset THIS_PROG
 #
 #if [ -r "$PHOENIX_HOME"/bin/setenv.sh ]; then
    1.  . "$PHOENIX_HOME"/bin/setenv.sh
 #fi

then very briefly I did this:

 ln -s /home/telrock/apps/james/bin/phoenix.sh /etc/init.d/james
 update-rc.d james start 21 2 3 4 5 . stop 19 0 1 6 .

Update for Mandrake Linux

If you're running Mandrake or any distro that uses config files in the /etc/rc.d/init.d directory, there're two much simpler ways. Well, two ways of doing the same thing actually. The first is to create a file in the /etc/rc.d/init.d directory called james with the following contents (remember to replace /home/james/james with the actual location of your james installation):

 #!/bin/sh
 # description: JAMES Mail Server
 # chkconfig: 2345 99 00

 case "$1" in
 'start')
         /home/james/james/bin/phoenix.sh start
         touch /var/lock/subsys/james
         ;;
 'stop')
         /home/james/james/bin/phoenix.sh stop
         rm -f /var/lock/subsys/james
         ;;
 *)
         echo "Usage: $0 { start | stop }"
         ;;
 esac
 exit 0

Alternatively, if you've got webmin installed, go to the system section and select "Bootup and Shutdown". Near the top of the page you'll see a link to create a new bootup and shutdown action. You can use that to create a service that's run at startup and shutdown. Just specify the comand:

 /home/james/james/bin/phoenix.sh start

in the box where it asks you for the bootup commands, and specify this command in the box where it asks for the shutdown commands:

 /home/james/james/bin/phoenix.sh stop

That should be it. You can test it by running

 /etc/rc.d/init.d/james start

to start and

 /etc/rc.d/init.d/james stop

to stop it.

Mac OS X

These instructions work on Mac OS X 10.2 and 10.3. I haven't tested them on 10.1.

Install James Most OS X services like James are stored in /Library, so a good place to store it would be /Library/James. You may want to follow the advice of storing the distro in /Library/James/james-2.x and then creating a soft link to it with this command:

 ln -s /Library/James/james-2.x /Library/James/Home

This creates the path /Library/James/Home, which leads you to the james-2.x directory. When a new version comes out, simply install james-3.x in /Library/James, delete the Home link and recreate it with the above command so that it points to james-3.x. This will save you from having to edit the startup scripts later.

StartupItems Mac OS X looks in /Library/StartupItems for services to start up at boot time. Go to this directory, and create it if it's not already there. Inside this dir, create another one named 'James'. The spelling and capitalization are important.

Next, create these two files in /Library/StartupItems/James:

StartupParameters.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Description</key>
  <string>Apache James Mail Server</string>
    <key>Messages</key>
    <dict>
      <key>start</key>
      <string>Starting Apache James Mail Server</string>
      <key>stop</key>
      <string>Stopping Apache James Mail Server</string>
    </dict>
    <key>OrderPreference</key>
    <string>Last</string>
    <key>Provides</key>
    <array>
      <string>James</string>
    </array>
    <key>Requires</key>
    <array>
      <string>Resolver</string>
    </array>
  </dict>
</plist>

These preferences provide the OS with hints as to when James should be started. OS X 10.2 needs James to start at the end of the boot process, or very near the end, so the OrderPreference key provides this hint. I am not sure what other service James depends on that requires this key, but this solved the problem for 10.2. OS X 10.3 doesn't need it to start last, so if you need James to start earlier for some reason, you can set it to None.

James

##
# Apache James Mail Server
##

. /etc/rc.common

StartService ()
{
    ConsoleMessage "Starting Apache James Mail Server"
    ${PHOENIX_HOME}/bin/phoenix.sh start
    ConsoleMessage -S
}

StopService ()
{
    ConsoleMessage "Stopping Apache James Mail Server"
    ${PHOENIX_HOME}/bin/phoenix.sh stop
    ConsoleMessage -S
}

RestartService ()
{
    ConsoleMessage "Restarting Apache James Mail Server"
    ${PHOENIX_HOME}/bin/phoenix.sh restart
    ConsoleMessage -S
}

export JAVA_HOME=/Library/Java/Home
export PHOENIX_HOME=/Library/James/Home

RunService "$1"

This 'James' file needs to be marked as executable, which can be set with this command:

 chmod 755 /Library/StartupItems/James/James

You are now ready to restart your Mac OS X box and have James start up automatically. After booting, you can control James using Apple's SystemStarter command:

 sudo SystemStarter stop James
 sudo SystemStarter start James
 sudo systemStarter restart James

These commands start, stop and restart James. They need to be run with 'sudo' so James can open it's listener ports.

RunAsService (last edited 2009-09-20 22:58:36 by localhost)