From 320f1c07a112d5d9b298a737a7407234d27d5fa0 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 12 Oct 2004 19:20:04 +0000 Subject: [PATCH] Sample start/stop script as used by Helsinki University --- etc/helka.sh | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 etc/helka.sh diff --git a/etc/helka.sh b/etc/helka.sh new file mode 100755 index 0000000..e90c974 --- /dev/null +++ b/etc/helka.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# $Id: helka.sh,v 1.1 2004-10-12 19:20:04 adam Exp $ +# YAZ proxy start/stop init.d script. + +# Config/DB +DB=helka +# Port +PORT=9021 + +PATH=/m1/voyager/yaz/bin:/bin:/usr/bin +export PATH + +# Proxy CWD is here. Should be writable by it. +DIR=/m1/voyager/${DB}db/local/yaz +# Proxy Path +DAEMON=/m1/voyager/yaz/bin/yazproxy + +# Proxy PIDFILE. Must be writable by it. +PIDFILE="yazproxy.pid" + +# Log file +LOGFILE=yazproxy.log + +# Run as this user. Set to empty to keep uid as is +RUNAS=voyager + +# Extra args . Config file _WITH_ option +ARGS="-c ${DB}.xml" + +if test -n "RUNAS"; then + ARGS="-u $RUNAS $ARGS" +fi + +# Increase number of sockets, if needed +#ulimit -n 1050 + +# Name, Description (not essential) +NAME=yazproxy +DESC="YAZ proxy $DB" + +test -d $DIR || exit 0 +test -f $DAEMON || exit 0 + +set -e + +case "$1" in + start) + printf "%s" "Starting $DESC: " + cd $DIR + $DAEMON -l $LOGFILE -p $PIDFILE $ARGS @:$PORT & + echo "$NAME." + ;; + stop) + printf "%s" "Stopping $DESC: " + cd $DIR + if test -f $PIDFILE; then + kill `cat $PIDFILE` + rm -f $PIDFILE + echo "$NAME." + else + echo "No PID $PIDFILE" + fi + ;; + reload) + cd $DIR + if test -f $PIDFILE; then + kill -HUP `cat $PIDFILE` + fi + ;; + restart|force-reload) + printf "%s" "Restarting $DESC: " + cd $DIR + if test -f $PIDFILE; then + kill `cat $PIDFILE` + rm -f $PIDFILE + fi + sleep 1 + cd $DIR + $DAEMON -l $LOGFILE -p $PIDFILE $ARGS @:$PORT & + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 -- 1.7.10.4