#!/bin/sh

# Gearman server and library
# Copyright (C) 2008 Brian Aker, Eric Day
# All rights reserved.
#
# Use and distribution licensed under the BSD license.  See
# the COPYING file in this directory for full text.

prefix=@prefix@
exec_prefix=@exec_prefix@
GEARMAND=@sbindir@/gearmand
PIDFILE=@localstatedir@/run/gearmand.pid

start()
{
  $GEARMAND -d -P $PIDFILE
}

stop()
{
  kill `cat $PIDFILE`
  rm -f $PIDFILE
}

case "$1" in

  start)
    start
  ;;

  stop)
    stop
  ;;

  restart)
    stop
    start
  ;;

  *)
    echo "Usage: $0 {start|stop|restart}"
  ;;

esac
