:
#	@(#) lp 25.3 92/09/11 
#
#	Copyright (C) 1988-1992 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#
##########
# If not invoked with at least one argument, assume we are
# running on a pre-SVR3.0 machine. We'll check our name to
# see what we do. Otherwise, the first argument tells what
# to do.
##########
if [ $# = 0 ]
then
	case $0 in
	*/lp-start )
		state=start
		;;
	*/lp-stop )
		state=stop
		;;
	esac
else
	state=$1
fi


case $state in

'start')
	if [ ! -f /usr/bin/lpstat ]
	then
		exit
	fi

	su root -c "/usr/bin/lpstat -r" | /bin/grep not  > /dev/null

	if [ 1 -eq "$?" ]
	then
		exit
	fi

# clear printer lock
	if [ -f /usr/spool/lp/SCHEDLOCK ] 
	then
		su root -c "rm -f /usr/spool/lp/SCHEDLOCK"
	fi
	if [ -f /usr/spool/lpd/lock ] 
	then
		su root -c "rm -f /usr/spool/lpd/lock"
	fi

	if [ -f /usr/lib/lpsched ] 
	then
		su root -c "/usr/lib/lpsched"
	fi
	;;
'stop')
	
	if [ -f /usr/lib/lpshut ] 
	then
		su root -c "/usr/lib/lpshut"
	fi
	;;
esac

