From: Adam Dickmeiss Date: Thu, 23 Oct 2003 10:02:14 +0000 (+0000) Subject: proxy.sh start/stop script X-Git-Tag: YAZPP.0.7.2~16 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=ea5275ed931fa06ac765dfb49e5af2036a6ec8b3;p=yazpp-moved-to-github.git proxy.sh start/stop script --- diff --git a/src/Makefile.am b/src/Makefile.am index de9f70c..09eb729 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.16 2003-10-06 19:32:03 adam Exp $ +## $Id: Makefile.am,v 1.17 2003-10-23 10:02:14 adam Exp $ AM_CXXFLAGS = $(YAZINC) -I$(srcdir)/../include $(XML2_CFLAGS) @@ -13,7 +13,7 @@ libyazcpp_la_SOURCES=yaz-socket-manager.cpp yaz-pdu-assoc.cpp \ bin_PROGRAMS = yaz-proxy noinst_PROGRAMS = yaz-my-server yaz-my-client bin_SCRIPTS = yaz++-config -EXTRA_DIST = config.xml +EXTRA_DIST = config.xml proxy.sh yaz_my_client_SOURCES=yaz-my-client.cpp diff --git a/src/proxy.sh b/src/proxy.sh new file mode 100755 index 0000000..3e1fc16 --- /dev/null +++ b/src/proxy.sh @@ -0,0 +1,85 @@ +#! /bin/sh +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg . +# Modified for Debian GNU/Linux +# by Ian Murdock . +# +# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl +# +PATH=/usr/local/bin:/bin:/usr/bin +export PATH + +RUNAS=nobody +LOGFILE=/var/log/proxy.log + +if test `whoami` != $RUNAS; then + touch $LOGFILE + chown $RUNAS $LOGFILE + su -c "$0 $*" $RUNAS + exit 0 +fi + +# Proxy CWD is here. Should be writable by it. +DIR=/var/proxy +# Proxy Path +DAEMON=/usr/local/bin/yaz-proxy +# Proxy PIDFILE. Must be writable by it. +PIDFILE=$DIR/proxy.pid +# Port +PORT=9000 +# Extra args . Config file _WITH_ option +ARGS="-c config.xml" + +# Name, Description (not essential) +NAME=yaz-proxy +DESC="YAZ proxy" + +test -d $DIR || exit 0 +test -f $DAEMON || exit 0 + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + cd $DIR + $DAEMON -l $LOGFILE -p $PIDFILE $ARGS @:$PORT & + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + + if test -f $PIDFILE; then + kill `cat $PIDFILE` + echo "$NAME." + else + echo "No PID $PIDFILE" + fi + ;; + reload) + if test -f $PIDFILE; then + kill -INT `cat $PIDFILE` + fi + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + if test -f $PIDFILE; then + kill `cat $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