#!/bin/sh
# $Id: lockerd,v 1.2 2003/09/22 19:30:51 wsnyder Exp $
# DESCRIPTION: Sample file to place in /etc/init.d to start the daemon
# Distributed with IPC::Locker
#
# Copyright 1999-2003 by Wilson Snyder.  This program is free software;
# you can redistribute it and/or modify it under the terms of either the GNU
# General Public License or the Perl Artistic License.

state=$1

# Source site start file
if [ -x /usr/local/common/etc/profile.d/site.sh ] ; then
    . /usr/local/common/etc/profile.d/site.sh
fi

case $state in
  start)
        echo starting /usr/local/bin/lockerd if present
        [ -f /usr/local/bin/lockerd ] && su daemon -c /usr/local/bin/lockerd &
        ;;
  stop)
        if test "x`pidof -o $$ -o $PPID -x lockerd`" != x; then
                echo -n $"Stopping lockerd: "
                kill `pidof -o $$ -o $PPID -x lockerd`
                echo
        fi
	exit 0
        ;;
  restart|reload)
	$0 stop
	$0 start
	exit 0
	;;
  status)
        if test "x`pidof -o $$ -o $PPID -x lockerd`" != x; then
  	        ps f -ww `pidof -o $$ -o $PPID -x lockerd`
        fi
	exit 0
	;;
*)
	echo $"Usage: $0 {start|stop|restart|reload|status}"
	exit 1
esac
