# functions	This file contains functions to be used by most or all
#		shell scripts in the /sbin/init.d directory.
#
# Version:	@(#) /sbin/init.d/functions 1.01 26-Oct-1993
#
# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

  # A function to start a program.
  daemon() {
	# Test syntax.
	if [ $# = 0 ]
	then
		echo "Usage: daemon {program}"
		return 1
	fi
	# See if it already runs.
	[ "`pidof $1`" != "" ] && return

	# echo basename of the program.
	echo -n "${1##*/} "

	# And start it up.
	[ -f $1 ] && { $* & }
  }

  # A function to stop a program.
  killproc() {
	# Test syntax.
	if [ $# != 2 ]
	then
	    echo "Usage: killprog {-SIG program}"
	    return 1
	fi

        pid=`pidof "$2"`
        [ "$pid" != "" ] && {
	    echo -n "SIG${1##-} $2 " ; builtin kill $1 $pid & }
  }

###
