db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: Derby Network Server As Service
Date Sun, 22 Mar 2009 14:50:26 GMT
> 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



Mime
View raw message