Add a start/stop script for pazpar2. The start/restart arguments
authorWolfram Schneider <wosch@apricot.panke.de.freebsd.org>
Mon, 12 Jan 2009 18:44:58 +0000 (19:44 +0100)
committerWolfram Schneider <wosch@apricot.panke.de.freebsd.org>
Mon, 12 Jan 2009 18:44:58 +0000 (19:44 +0100)
supports pazpar2 options, e.g. to restart pazpar2 with edu targets:

./src/pazpar2.sh restart -t etc/edu.xml

src/pazpar2.sh [new file with mode: 0755]

diff --git a/src/pazpar2.sh b/src/pazpar2.sh
new file mode 100755 (executable)
index 0000000..528aa3d
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# pazpar2.sh - pazpar2 start/stop script
+
+PAZPAR2_HOME=$HOME/pazpar2
+pazpar2_program=$PAZPAR2_HOME/src/pazpar2
+pazpar2_config=$PAZPAR2_HOME/etc/pazpar2.cfg
+pazpar2_pid=$PAZPAR2_HOME/pazpar2.pid
+pazpar2_log=$PAZPAR2_HOME/pazpar2.log
+
+command=$1; shift
+
+case "$command" in
+       start)
+               $pazpar2_program -D -l $pazpar2_log -p $pazpar2_pid -f $pazpar2_config "$@"
+               ;;
+
+       stop) 
+               test -f $pazpar2_pid && kill `cat $pazpar2_pid`
+               ;;
+
+       # graceful restart - not yet implemented by pazpar2
+       graceful)
+               test -f $pazpar2_pid && kill -HUP `cat $pazpar2_pid`
+               ;;
+
+       restart)
+               $0 stop
+               $0 start "$@"
+               ;;
+
+       *)
+        echo "Usage: `basename $0` [ start [pazpar2 options]] [ stop | restart ]" >&2
+        ;;
+esac
+
+exit 0
+