You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Christoph Thodte <ch...@thodte.com> on 2009/03/22 13:00:59 UTC

Derby Network Server As Service

Hello,
Can I start the derby network server as a linux service?

Regards
Christoph

Re: Derby Network Server As Service

Posted by Christoph Thodte <ch...@googlemail.com>.
Thx it work's for me fine ;-)

On Sun, Mar 22, 2009 at 3:50 PM, Bryan Pendleton
<bp...@amberpoint.com>wrote:

> Can I start the derby network server as a linux service?
>>
>
> Absolutely. Just write yourself a short init.d script and install it
> using chkconfig or whatever you use.
>
> I pasted a copy of something I use on a RedHat system below.
>
> thanks,
>
> bryan
>
> #!/bin/sh
> #
> # Startup script for Derby, the database server
> #
> # chkconfig: 345 90 10
> # description: Derby is the database server
> # processname: derby
> # pidfile: /var/run/derby.pid
>
> if [ -z "$DERBY_USER" ]; then
>  DERBY_USER="build_user"
> fi
>
> RETVAL=0
>
> # start and stop functions
> start() {
>    echo -n "Starting derby: "
>
>    su -l $DERBY_USER -c 'cd /path/to/derby;nohup
> $DERBY_INSTALL/bin/startNetworkServer -h MyMachine &'
>    RETVAL=$?
>    echo
>    [ $RETVAL = 0 ] && touch /var/lock/subsys/derby
>    return $RETVAL
> }
>
> stop() {
>    echo -n "Stopping derby: "
>    su -l $DERBY_USER -c 'cd
> /path/to/derby;$DERBY_INSTALL/bin/stopNetworkServer -h MyMachine '
>    RETVAL=$?
>    echo
>    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/derby /var/run/derby.pid
> }
>
> # See how we were called.
> case "$1" in
>  start)
>        start
>        ;;
>  stop)
>        stop
>        ;;
>  restart)
>        stop
>    # Ugly hack
>    # We should really make sure derby
>    # is stopped before leaving stop
>        sleep 2
>        start
>        ;;
>  *)
>    echo "Usage: $0 {start|stop|restart}"
>    exit 1
> esac
>
> exit $RETVAL
>
>
>

Re: Derby Network Server As Service

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> Can I start the derby network server as a linux service?

Absolutely. Just write yourself a short init.d script and install it
using chkconfig or whatever you use.

I pasted a copy of something I use on a RedHat system below.

thanks,

bryan

#!/bin/sh
#
# Startup script for Derby, the database server
#
# chkconfig: 345 90 10
# description: Derby is the database server
# processname: derby
# pidfile: /var/run/derby.pid

if [ -z "$DERBY_USER" ]; then
  DERBY_USER="build_user"
fi

RETVAL=0

# start and stop functions
start() {
     echo -n "Starting derby: "

     su -l $DERBY_USER -c 'cd /path/to/derby;nohup $DERBY_INSTALL/bin/startNetworkServer -h MyMachine &'
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] && touch /var/lock/subsys/derby
     return $RETVAL
}

stop() {
     echo -n "Stopping derby: "
     su -l $DERBY_USER -c 'cd /path/to/derby;$DERBY_INSTALL/bin/stopNetworkServer -h MyMachine '
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] && rm -f /var/lock/subsys/derby /var/run/derby.pid
}

# See how we were called.
case "$1" in
   start)
         start
         ;;
   stop)
         stop
         ;;
   restart)
         stop
     # Ugly hack
     # We should really make sure derby
     # is stopped before leaving stop
         sleep 2
         start
         ;;
   *)
     echo "Usage: $0 {start|stop|restart}"
     exit 1
esac

exit $RETVAL