:
#	@(#) lp 1.10 89/07/10 
#
#    Portions Copyright 1988-1989 The Santa Cruz Operation, Inc
#		      All Rights Reserved
##########
#
# 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


#set `who -r`
#if [ "$8" != "0" ]
#then
#	exit
#fi
case $state in

'start')
	if [ "$9" = "2" -o "$9" = "3" ]
	then
		exit
	fi

# clear printer lock
	if [ -f /usr/spool/lp/SCHEDLOCK ] 
	then
		if [ -f /usr/lib/lpshut ] 
		then
			su root -c "/usr/lib/lpshut"
		fi
		if [ -f /usr/spool/lp/SCHEDLOCK ] 
		then
			su root -c "rm -f /usr/spool/lp/SCHEDLOCK"
		fi
	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

