baa8c177afcbe09a5b91f9cbdae73e89b6679f94
[pazpar2-moved-to-github.git] / src / pazpar2.sh
1 #!/bin/sh
2 #
3 # pazpar2.sh - pazpar2 start/stop script
4
5 : ${PAZPAR2_HOME=$HOME/pazpar2}
6 pazpar2_program=$PAZPAR2_HOME/src/pazpar2
7 pazpar2_config=$PAZPAR2_HOME/etc/pazpar2.cfg
8 pazpar2_pid=$PAZPAR2_HOME/pazpar2.pid
9 pazpar2_log=$PAZPAR2_HOME/pazpar2.log
10
11 command=$1; shift
12
13 case "$command" in
14         start)
15                 $pazpar2_program -D -l $pazpar2_log -p $pazpar2_pid -f $pazpar2_config "$@"
16                 ;;
17
18         stop) 
19                 test -f $pazpar2_pid && kill `cat $pazpar2_pid`
20                 ;;
21
22         # graceful restart - not yet implemented by pazpar2
23         graceful)
24                 test -f $pazpar2_pid && kill -HUP `cat $pazpar2_pid`
25                 ;;
26
27         restart)
28                 $0 stop
29                 $0 start "$@"
30                 ;;
31
32         *)
33         echo "Usage: `basename $0` [ start [pazpar2 options]] [ stop | restart ]" >&2
34         ;;
35 esac
36
37 exit 0
38