tar -zxvf db-derby-10.13.1.1-bin.tar.gz
mv db-derby-10.13.1.1-bin /opt/derby
cd /opt/derby
mkdir daemon
cd daemon
vi derby
#!/bin/sh
#
# derby - this script starts and stops the derby daemon
#
# chkconfig: - 85 15
# description: derby is a java Database
# processname: derby
# pidfile: /var/run/derby.pid
DERBY_HOME=/opt/derby
DERBY_HOST=0.0.0.0
DERBY_PORT=1527
case "$1" in
start)
$DERBY_HOME/bin/startNetworkServer -h $DERBY_HOST -p $DERBY_PORT &
break
;;
stop)
$DERBY_HOME/bin/stopNetworkServer -p $DERBY_PORT
break
;;
status)
$DERBY_HOME/bin/NetworkServerControl ping -p $DERBY_PORT >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo "The derby service is running."
else
echo "Cannot find derby service."
fi
break
;;
*)
echo "Usage: /etc/init.d/derby {start|stop|status}"
;;
esac
cp derby /etc/init.d/
service derby start