Rick Hillegas wrote:
Hi Chris,
I don't know whether you have seen the startNetworkServer script which
is supplied in the bin directory of Derby distributions. It may do a lot
of your work for you. For more information on starting up the network
server, please see the section titled "Starting the Network Server" in
the Derby Server and Administration Guide:
http://db.apache.org/derby/docs/10.4/adminguide/
Hope this helps,
-Rick
Hi Rick,
Apart from sourcing derby_common.sh, the startNetworkServer script does
the same as my start script, so the problem I describe would also affect
someone logging in remotely to start Derby with that script.
Regards,
Chris
PS - Apologies for the ridiculously long signature on my emails, it's
added automatically by my company mail server.
Chris Wareham wrote:
Hi,
I've searched the FAQ, wiki and Nabble's archive for this list but not
found an example init script for running Derby's Network Server. I have
put together a basic init script, but it has one problem which I am
hoping someone on the list can solve for me. The script works fine when
the server is rebooted, but if I login via ssh and restart Derby with
the init script, my shell hangs when I logout. I guess that even though
I run the init script as root, the Derby process is somehow associated
with my login session and prevents me from successfully logging out. I
don't want to use nohup, as it leaves an annoying log file laying around
- there must be a better solution!
My init script is as follows:
#!/bin/sh
# Starts and stops the derby database
DERBY_HOME=/home/derby
DERBY_USER=derby
derby_start () {
su -l $DERBY_USER -c "$DERBY_HOME/bin/start_derby >
$DERBY_HOME/logs/derby.log &"
}
derby_stop () {
su -l $DERBY_USER -c "$DERBY_HOME/bin/stop_derby >
$DERBY_HOME/logs/derby.log &"
}
case "$1" in
start)
derby_start
;;
stop)
derby_stop
;;
restart)
derby_stop
sleep 5
derby_start
;;
*)
echo "Usage: /etc/init.d/derby {start|stop|restart}"
exit 1
;;
esac
exit 0
The start script is as follows:
#!/bin/sh
start_command="exec $JAVA_HOME/bin/java $DERBY_OPTS -classpath
$DERBY_CLASSPATH org.apache.derby.drda.NetworkServerControl start $@"
eval $start_command
And the stop script is as follows:
#!/bin/sh
stop_command="exec $JAVA_HOME/bin/java $DERBY_OPTS -classpath
$DERBY_CLASSPATH org.apache.derby.drda.NetworkServerControl shutdown $@"
eval $stop_command
The following relevant entries are in the derby user's shell config:
JAVA_HOME=/usr/java/default
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH
DERBY_HOME=$HOME
DERBY_CLASSPATH="$HOME/lib/derbynet.jar:$HOME/lib/derby.jar"
DERBY_OPTS="-Dderby.system.home=$HOME/derby"
export DERBY_HOME DERBY_CLASSPATH DERBY_OPTS
Chris Wareham
Senior Software Engineer
Visit London Ltd
6th floor,
2 More London Riverside, London SE1 2RR
Tel: +44 (0)20 7234 5848
Fax: +44 (0)20 7234 5753
www.visitlondon.com
Save the date for the Visit London Awards 2008!
Thursday 27th November, Royal Albert Hall.
'Visit London Limited' is registered in England under No.761149;
Registered Office: Visit London, 2 More London Riverside, London SE1 2RR.
Visit London is the official visitor organisation for London. Visit London is
partly funded by Partnership, the Mayor's London Development Agency and London
Councils.
The information contained in this e-mail is confidential and intended for the
named recipient(s) only. If you have received it in error, please notify the
sender immediately and then delete the message. If you are not the intended
recipient, you must not use, disclose, copy or distribute this email. The views
expressed in this e-mail are those of the individual and not of Visit London.
We reserve the right to read and monitor any email or attachment entering or
leaving our systems without prior notice.
Please don't print this e-mail unless you really need to.