Step 8 – Automatic Start/Stop Mandriva/Mandrake 10.x

Version française du document : http://www.apachefrance.com/Forums/index.php?showtopic=3606

Source Links :

1°-- Installl Java Service wrapper –

urpmi tanukiwrapper-3.1.2-1jpp.i386.rpm

We Get :

  • /usr/lib/libwrapper.so
  • /usr/share/doc/tanukiwrapper-3.1.2/license.txt
  • /usr/share/java/tanukiwrapper-3.1.2.jar
  • /usr/share/java/tanukiwrapper-test-3.1.2.jar
  • /usr/share/java/tanukiwrapper-test.jar
  • /usr/share/java/tanukiwrapper.jar
  • /usr/share/tanukiwrapper-3.1.2/bin
  • /usr/share/tanukiwrapper-3.1.2/bin/testwrapper
  • /usr/share/tanukiwrapper-3.1.2/bin/wrapper
  • /usr/share/tanukiwrapper-3.1.2/conf
  • /usr/share/tanukiwrapper-3.1.2/conf/wrapper.conf
  • Manual >> /usr/share/doc/tanukiwrapper-manual-3.1.2
  • Examples >> /usr/share/doc/tanukiwrapper-manual-3.1.2/test

2°-- Prepare Files

A>>- Prepare  requested Files

A-1 copy script file from /usr/share/tanukiwrapper-3.1.2/bin/testwrapper TWICE to obtain two renaming files like this:

  • dsy_openjms.sh
  • dsy_repo.sh

A-2 copy script file from /usr/share/tanukiwrapper-3.1.2/bin/testwrapper TWICE to obtain two renaming files like this:

  • dsy_openjms_wrapper.conf
  • dsy_repo_wrapper.conf

3°- modify files

M1-> path to wrapper.jar - Modify - dsy_openjms.sh & dsy_repo.sh

replace....

wrapper.java.classpath.2=../lib/wrapper.jar

By ...

wrapper.java.classpath.2=/usr/share/java/tanukiwrapper.jar 

M2> path to libwrapper.so

  • -> replace
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib
  • -> by
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=/usr/lib

M3-> environment Parametersto include in .sh files (top)

WRAPPER_HOME=/usr/share/tanukiwrapper-3.1.2 ; export WRAPPER_HOME
DAISY_HOME=/usr/share/daisy ; export DAISY_HOME
OPENJMS_HOME=/usr/share/daisy/openjms ; export OPENJMS_HOME
DAISY_DATADIR=/var/local/daisydata ; export DAISY_DATADIR
MERLIN_HOME=$DAISY_HOME/repository-server/merlin ; export MERLIN_HOME

M4> few change in dsy_openjms.sh & dsy_repo.sh .

-> replace

PIDDIR=*.*

-> by

PIDDIR= »/var/run »

M5>- specific information for th Mandriva ‘chkconfig’

Scripts files must include few lines with a strict syntax and as minimum # chkconfig & # description:

  • # chkconfig: 345 90 10 == (runlevel) service Niveau 3, 4, 5 >> SO,  rc3.d, rc4.d etc.. , xx et yy (xx+yy=100)  and xx is the rank order for start and yy for stop process – We will get a S90toto & K90toto files with chkconfig
  • # description : service in few words, appears as label in console . use "\" for break lines

As example : we have Tomcat5 S80 K20 and We want that dsy_openjms.sh & dsy_repo.sh Start Before & Stop After (Apache Start and Stop after Tomcat5)

M5-a- AutoStart OpenJMS Service (dsy_openjms.sh )

Add at the second line position in files

# description: Daisy OpenJMS Service
# chkconfig: 2345 76 24
# processname: dsy_openjms
# pidfile: /var/run/dsy_openjms.pid

M5-b- AutoStart Daisy Repository Server Service (dsy_repo.sh )

Add at the second line position in files

# description: Daisy Repository Server Service
# chkconfig: 2345 78 22
# processname: dsy_repo
# pidfile: /var/run/dsy_repo.pid

4°- configure autostart

1°-- Move Wrapper & Scripts Files

Move to /usr/share/daisy/openjms/bin

  1. - dsy_openjms (sans .sh)
  2. - dsy_openjms_wrapper.conf

Move to /usr/share/daisy/repository-server/bin

  1. - dsy_repo (sans .sh)
  2. - dsy_repo_wrapper.conf

2°-- Test your Scripts - Usage: ./dsy_repo { console | start | stop | restart | status | dump }

Start (respect order)

./dsy_openjms start
./dsy_repo start

Stop (respect order)

./dsy_repo stop
./dsy_openjms stop

3°-- Symbol Links in /etc/init.d

ln -s /usr/share/daisy/openjms/bin/dsy_openjms /etc/init.d/dsy_openjms
ln -s /usr/share/daisy/repository-server/bin/dsy_repo /etc/init.d/dsy_repo 

Test LN as changing current directory to /etc/init.d  And  executing scripts (respect order)

4° - configure start/stop wit the chkconfig Mandriva command

chkconfig --add dsy_openjms
chkconfig --add dsy_repo

“chkconfig” replace on Mandriva  (update-rc.d dsy_openjms start 76 2 3 4 5 . stop 24 0 1 6 .) and  ( update-rc.d dsy_repo start 78 2 3 4 5 . stop 22 0 1 6 .) on others Linux systems

And now??

Okay, you shutdown then you start your Mandriva Machine to test ..

There is a little trick to fix that i didn't found .. in Console Manager as dsy-xx are stopped or started, i don't get the status displayed ..

Fields

NameValue
CategoryInstall & config