:


# Standard directory variables from autoconf
prefix=/usr/local
datarootdir=${prefix}/share
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
sbindir=${exec_prefix}/sbin
libexecdir=${exec_prefix}/libexec
datadir=${datarootdir}
sysconfdir=${prefix}/etc
scd=$(sysconfdir)
libdir=${exec_prefix}/lib
sharedlibdir=$(libdir)/shared
mandir=${datarootdir}/man
includedir=${prefix}/include
localstatedir=${prefix}/var

RUNDIR=${localstatedir}/run/printqd
LOGDIR=${localstatedir}/log/printqd
DBDIR=${localstatedir}/printqd
LPUSER=lp
LPGROUP=lp

. ${sysconfdir}/rc.d/init.d/functions

start() {
	[ -d $RUNDIR ] || mkdir -p $RUNDIR
	[ -d $LOGDIR ] || mkdir -p $LOGDIR
	[ -d $DBDIR  ] || mkdir -p $DBDIR
	chown -R ${LPUSER}:${LPGROUP} $RUNDIR
	chown -R ${LPUSER}:${LPGROUP} $LOGDIR
	chown -R ${LPUSER}:${LPGROUP} $DBDIR
	chmod -R 770 $RUNDIR
	chmod -R 770 $LOGDIR
	chmod -R 770 $DBDIR
	${sbindir}/printqd
}

stop() {
	killproc printqd
}

case "$*" in
"start")
	start
;;
"stop")
	stop
;;
"restart")
	stop
	sleep 1
	start
	sleep 1
;;

esac

