01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/bin/sh
# $Id$
### Init file for Z (SRU/W) server daemon
# chkconfig: 2345 99 01
# description: Z39.50 & SRU/W server daemon
#
# processname: ztest.pl
ZSERVER_DIR=/opt/epi-zserver
ZSERVER_USER=zserver
ZSERVER_PORT=8080
base=`basename $0`
ZSERVER_PID="/var/run/$base.pid"
case "$1" in
start)
cd $ZSERVER_DIR && ./ztest.pl -u $ZSERVER_USER -D -p $ZSERVER_PID -m "%Y-%m-%dT%H:%M:%S" tcp:@:$ZSERVER_PORT
;;
stop)
kill `cat $ZSERVER_PID`
rm -f $ZSERVER_PID
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
% cd /etc/init.d
% sudo ln -s /opt/epi-zserver/epi-zserver.sh epi-zserver
% sudo chkconfig --add epi-zserver