#!/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=/usr/local
exec_prefix=${prefix}
GEARMAND=${exec_prefix}/sbin/gearmand
PIDFILE=${prefix}/var/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
