1# 2# -- START -- 3# init.linux.sh,v 1.1 2001/08/21 20:33:15 root Exp 4# 5# lpd This shell script takes care of starting and stopping 6# lpd (printer daemon). 7# Taken from the RedHat Linux 6.2 distribution for the lpd startup 8# modified to make things a little more robust 9# 10# chkconfig: 2345 60 60 11# description: lpd is the print daemon required for lpr to work properly. \ 12# It is basically a server that arbitrates print jobs to printer(s). 13# processname: lpd 14# config: /etc/printcap 15 16# Source function library. 17if [ -f /etc/rc.d/init.d/functions ] ; then 18. /etc/rc.d/init.d/functions 19fi 20 21# Source networking configuration. 22if [ -f /etc/sysconfig/network ] ; then 23. /etc/sysconfig/network 24fi 25 26# Check that networking is up. 27[ "${NETWORKING}" = "no" ] && exit 0 28[ -f "${LPD_PATH}" ] || exit 0 29[ -f /etc/printcap ] || exit 0 30 31RETVAL=0 32 33 34# ignore INT signal 35trap '' 2 36 37# See how we were called. 38case "$1" in 39 start) 40 # Start daemons. 41 echo -n "Starting lpd: " 42 if [ -f /etc/redhat-release ] ; then 43 daemon ${LPD_PATH} 44 RETVAL=$? 45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lprng 46 else 47 ${LPD_PATH} 48 RETVAL=$? 49 fi 50 echo 51 ;; 52 stop) 53 # Stop daemons. 54 echo -n "Shutting down lprng: " 55 if [ -f /etc/redhat-release ] ; then 56 killproc lpd 57 RETVAL=$? 58 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/lprng 59 else 60 kill -INT `ps ${PSHOWALL} | awk '/lpd/{ print $1;}'` >/dev/null 2>&1 61 RETVAL=0 62 fi 63 echo 64 ;; 65 status) 66 if [ -f /etc/redhat-release ] ; then 67 status lpd 68 else 69 lpc lpd 70 fi 71 RETVAL=$? 72 ;; 73 restart|reload) 74 $0 stop 75 $0 start 76 RETVAL=$? 77 ;; 78 *) 79 echo "Usage: $0 {start|stop|restart|reload|status}" 80 exit 1 81esac 82 83exit $RETVAL 84