#!/bin/sh

test -x /usr/bin/bric_queued || exit 0

# Source defaults file.
PARAMS=''
PIDFILE=/var/run/bricolage/queued.pid
LOGFILE=/var/log/bricolage/queued.log
USER=bricolage
if [ -f /etc/default/bric_queued ]; then
  . /etc/default/bric_queued
fi

if [ "${DELAY}" != "" ] ; then
  PARAMS="-d ${DELAY}"
fi

PARAMS="${PARAMS} -p ${PIDFILE} -l ${LOGFILE} --username ${BQ_USER:-bricolage} --password ${BQ_PASSWD:-blah}"


case "$1" in
start)
  echo -n "Starting Bricolage publish queue: bric_queued"
  start-stop-daemon --start --quiet --chuid ${USER} \
                    --exec /usr/bin/bric_queued \
                    -- $PARAMS
  echo "."
  ;;
stop)
  echo -n "Stopping Bricolage publish queue: bric_queued"
  start-stop-daemon --stop --quiet \
    --pidfile ${PIDFILE}
  echo "."
  ;;
restart|force-reload|reload)
  echo -n "Restarting Bricolage publish queue: bric_queued"
  start-stop-daemon --stop --quiet --oknodo \
    --pidfile ${PIDFILE}
  start-stop-daemon --start --verbose --chuid ${USER} \
                    --exec /usr/bin/bric_queued \
                    -- $PARAMS
  echo "."
  ;;
*)
  echo "Usage: $0" \
         " {start|stop|restart|reload|force-reload}" >&2
  exit 1
  ;;
esac

exit 0

 

