|
Revision 4115, 1.1 kB
(checked in by sylvain.hellegouarch, 1 year ago)
|
Added the queue server service
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/bin/sh |
|---|
| 2 |
# |
|---|
| 3 |
# qs - Manage a bucker queue server |
|---|
| 4 |
# |
|---|
| 5 |
PID_FILE=/tmp/lluppub.pid |
|---|
| 6 |
PORT=9879 |
|---|
| 7 |
QUEUES= |
|---|
| 8 |
QUEUE_SERVER=127.0.0.1:9876 |
|---|
| 9 |
|
|---|
| 10 |
function check_status { |
|---|
| 11 |
if [ -f $PID_FILE ]; then |
|---|
| 12 |
PID=`cat $PID_FILE` |
|---|
| 13 |
result=`ps -p $PID|grep $PID|grep -v grep` |
|---|
| 14 |
case $result in |
|---|
| 15 |
"") echo "queue server is not running" ;; |
|---|
| 16 |
*) echo "queue server is running with PID: $PID" ;; |
|---|
| 17 |
esac |
|---|
| 18 |
else |
|---|
| 19 |
echo "queue server is not running" |
|---|
| 20 |
fi |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
function kill_server { |
|---|
| 24 |
if [ -f $PID_FILE ]; then |
|---|
| 25 |
PID=`cat $PID_FILE` |
|---|
| 26 |
result=`ps -p $PID|grep $PID|grep -v grep` |
|---|
| 27 |
case $result in |
|---|
| 28 |
*) |
|---|
| 29 |
`kill -USR1 $PID` |
|---|
| 30 |
`kill -15 $PID` |
|---|
| 31 |
`kill -9 $PID` |
|---|
| 32 |
;; |
|---|
| 33 |
esac |
|---|
| 34 |
fi |
|---|
| 35 |
|
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
case $1 in |
|---|
| 39 |
|
|---|
| 40 |
start) |
|---|
| 41 |
|
|---|
| 42 |
echo "Starting the llup publisher server on port $PORT against queue server at $QUEUE_SERVER and monitoring $2" |
|---|
| 43 |
# add -v to the line below to enable logging to the console |
|---|
| 44 |
llup-queue-publisher.py -s $QUEUE_SERVER -q $2 -i $PID_FILE -f 5.0 & |
|---|
| 45 |
;; |
|---|
| 46 |
|
|---|
| 47 |
stop) |
|---|
| 48 |
echo "Stopping the llup publisher server." |
|---|
| 49 |
kill_server |
|---|
| 50 |
;; |
|---|
| 51 |
|
|---|
| 52 |
status) |
|---|
| 53 |
check_status |
|---|
| 54 |
;; |
|---|
| 55 |
|
|---|
| 56 |
*) |
|---|
| 57 |
echo "usage: $0 start|stop|status"; |
|---|
| 58 |
;; |
|---|
| 59 |
|
|---|
| 60 |
esac |
|---|
| 61 |
|
|---|
| 62 |
# end of qs.sh |
|---|