You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Fernando Padilla <fe...@interdimensions.com> on 2002/05/23 18:52:03 UTC

etc/rc.d/init.d script

Hello.

Has anyone out there created a script that can be used for the init.d 
system?

fernando


Re: etc/rc.d/init.d script

Posted by Fernando Padilla <fe...@interdimensions.com>.
good simple one :)

As an aside I was wondering if we should adapt the start script to support 
the init.d script parameters.  Because it already has startup, shutdown, 
and restart functionality, just not exposed....  just a thought.. maybe 
I'll submit a patch in a bit

fernando

On Thu, 23 May 2002, Carsten Ziegert wrote:

> Am 23.05.2002 18:52 Uhr schrieb "Fernando Padilla" unter
> <fe...@interdimensions.com>:
> 
> > 
> > Hello.
> > 
> > Has anyone out there created a script that can be used for the init.d
> > system?
> > 
> > fernando
> > 
> > 
> 
> 
> Try this one:
> 
> #!/bin/sh
> 
> JAVA_HOME=/usr/java
> export JAVA_HOME
> 
> XINDICE_HOME=/home/summit/xindice
> export XINDICE_HOME
> 
> 
> if [ $# -lt 1 ]
> then
>         echo "usage: xindice [ start | stop ]"
>         exit
> fi
> 
> if [ "$1" = "start" ]
> then
>         cd $XINDICE_HOME
>         ./start &
>         exit
> fi
> 
> if [ "$1" = "stop" ]
> then
>         $XINDICE_HOME/bin/xindiceadmin shutdown -c /db
>         exit
> fi
> 
> echo "usage: xindice [ start | stop ]"
> exit
> 
> 
> 
> :-) Carsten
> 
> --
> 
> Medizinische Hochschule Hannover                    Fachhochschule Hannover
> Abt. Hämatologie und Onkologie     FB Informations- und Kommunikationswesen
> Carl-Neuberg-Straße 1                               Ricklinger Stadtweg 120
> 30625 Hannover                                               30459 Hannover
> 
>                            ++49-511-9296-1650
>                     http://summit-bmt.fh-hannover.de
> 
> 
> 
> 
> 
> 


Re: etc/rc.d/init.d script

Posted by Stijn Van Vreckem <st...@pandora.be>.
Here is another one ... 

#!/bin/bash
#
# Xindice  This starts and stops Xindice.
#
# chkconfig: 345 82 15
# description: Xindice is an XML database

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

# Setting Java environement

 export JAVA_HOME=/usr/java/j2sdk1.4.0
 export PATH=$PATH:$JAVA_HOME/bin

# Setting xindice home

export XINDICE_HOME=/usr/local/xindice

start(){
    echo -n $"Starting Xindice: "


    # Starting up Xindice

    daemon /usr/local/xindice/start > /dev/null &

    RETVAL=$?
    echo
    return $RETVAL
}

stop(){
    echo -n $"Stopping Xindice: "

    /usr/local/xindice/bin/xindiceadmin shutdown -c /db

    RETVAL=$?
    echo
    return $RETVAL
}
reload(){
    stop
    start
}

restart(){
    stop
    start
}

condrestart(){
    stop
    start
}


# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
    if ps -ef | grep -c "java -Xms16m -Xmx168m -Dxindice" > /dev/null
    then echo "Xindice is running ..."
    else echo "Xindice is stopped ..."
     fi
    echo
        ;;
    restart)
        restart
        ;;
    reload)
        reload
        ;;
    condrestart)
        condrestart
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        RETVAL=1

esac

exit $RETVAL

On Thu, 23 May 2002, Carsten Ziegert wrote:

> Am 23.05.2002 18:52 Uhr schrieb "Fernando Padilla" unter
> <fe...@interdimensions.com>:
> 
> > 
> > Hello.
> > 
> > Has anyone out there created a script that can be used for the init.d
> > system?
> > 
> > fernando
> > 
> > 
> 
> 
> Try this one:
> 
> #!/bin/sh
> 
> JAVA_HOME=/usr/java
> export JAVA_HOME
> 
> XINDICE_HOME=/home/summit/xindice
> export XINDICE_HOME
> 
> 
> if [ $# -lt 1 ]
> then
>         echo "usage: xindice [ start | stop ]"
>         exit
> fi
> 
> if [ "$1" = "start" ]
> then
>         cd $XINDICE_HOME
>         ./start &
>         exit
> fi
> 
> if [ "$1" = "stop" ]
> then
>         $XINDICE_HOME/bin/xindiceadmin shutdown -c /db
>         exit
> fi
> 
> echo "usage: xindice [ start | stop ]"
> exit
> 
> 
> 
> :-) Carsten
> 
> --
> 
> Medizinische Hochschule Hannover                    Fachhochschule Hannover
> Abt. Hämatologie und Onkologie     FB Informations- und Kommunikationswesen
> Carl-Neuberg-Straße 1                               Ricklinger Stadtweg 120
> 30625 Hannover                                               30459 Hannover
> 
>                            ++49-511-9296-1650
>                     http://summit-bmt.fh-hannover.de
> 
> 
> 
> 
> 
> 

-- 

Stijn Van Vreckem





Re: etc/rc.d/init.d script

Posted by Fernando Padilla <fe...@interdimensions.com>.
duh..

ofcourse, the last place you look: $XINDICE_HOME/xindice.server



On Thu, 23 May 2002, Carsten Ziegert wrote:

> Am 23.05.2002 18:52 Uhr schrieb "Fernando Padilla" unter
> <fe...@interdimensions.com>:
> 
> > 
> > Hello.
> > 
> > Has anyone out there created a script that can be used for the init.d
> > system?
> > 
> > fernando
> > 
> > 


Re: etc/rc.d/init.d script

Posted by Carsten Ziegert <ca...@ik.fh-hannover.de>.
Am 23.05.2002 18:52 Uhr schrieb "Fernando Padilla" unter
<fe...@interdimensions.com>:

> 
> Hello.
> 
> Has anyone out there created a script that can be used for the init.d
> system?
> 
> fernando
> 
> 


Try this one:

#!/bin/sh

JAVA_HOME=/usr/java
export JAVA_HOME

XINDICE_HOME=/home/summit/xindice
export XINDICE_HOME


if [ $# -lt 1 ]
then
        echo "usage: xindice [ start | stop ]"
        exit
fi

if [ "$1" = "start" ]
then
        cd $XINDICE_HOME
        ./start &
        exit
fi

if [ "$1" = "stop" ]
then
        $XINDICE_HOME/bin/xindiceadmin shutdown -c /db
        exit
fi

echo "usage: xindice [ start | stop ]"
exit



:-) Carsten

--

Medizinische Hochschule Hannover                    Fachhochschule Hannover
Abt. Hämatologie und Onkologie     FB Informations- und Kommunikationswesen
Carl-Neuberg-Straße 1                               Ricklinger Stadtweg 120
30625 Hannover                                               30459 Hannover

                           ++49-511-9296-1650
                    http://summit-bmt.fh-hannover.de






SV: etc/rc.d/init.d script

Posted by Anders Conrad <ac...@dsl.dk>.
Here is one that does not run xindice as root. The prerequisite is that
the proper environment is set up in a profile for the XINDICE_USER that
owns the database instance.

Anders

------------------------------------------------------------------------
#!/bin/sh
#
# Start og stop af Xindice XML-database
#
# Baseret på dbXML/start scriptet
#
# AC 21.12.2001

#
# load the configuration
#
. /etc/rc.config
. /etc/rc.status   

#
# The echo return value for success (defined in /etc/rc.config).
#
return=$rc_done

XINDICE_USER=xindice

if test -z "$XINDICE_HOME"; then
   XINDICE_HOME=/opt/xindice
   export XINDICE_HOME
fi

PID_FILE=$XINDICE_HOME/config/xindice.pid

case $1 in 

start)
	echo -n "Starting Xindice"

	# Check for leftover pid-file after crash
	# NB Only allowed in system startup procedure!
	if [ -f "$PID_FILE" ]
	then 
		rm $PID_FILE
	fi

	su - $XINDICE_USER -c "./start &" || return=$rc_failed

	echo $return
;;

stop)
	echo -n "Shutting down Xindice"
	su - $XINDICE_USER -c "xindiceadmin shutdown -c /db" ||
return=$rc_failed 
	echo $return
;;

restart)
        $0 stop  && sleep 3 &&  $0 start  ||  return=$rc_failed
	echo $return
;;

esac

------------------------------------------------------------------


Anders Conrad
Redaktør, cand.mag.
Det Danske Sprog- og Litteraturselskab
E-mail: ac@dsl.dk
Tlf. (+45) 33 13 84 20 - 9626


-----Oprindelig meddelelse-----
Fra: Fernando Padilla [mailto:fern@interdimensions.com] 
Sendt: 23. maj 2002 18:52
Til: xindice-users@xml.apache.org
Emne: etc/rc.d/init.d script



Hello.

Has anyone out there created a script that can be used for the init.d 
system?

fernando