This file is indexed.

/etc/init.d/lprng is in lprng 3.8.B-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#! /bin/sh
### BEGIN INIT INFO
# Provides: lprng
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start lpd to allow printing
# Description: lpd is the print daemon required for lpr to work properly.
#   It is basically a server that arbitrates print jobs to printer(s).
### END INIT INFO
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - misc error
# 2 - invalid or excess args
# 3 - unimplemented feature (e.g. reload)
# 4 - insufficient privilege
# 5 - program not installed
# 6 - program not configured
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.


PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="LPRng printer spooler"
NAME=lprng
DAEMON=/usr/sbin/lpd
CONFIGDIR=/etc/lprng
PRINTCAP=/etc/printcap
LPDPRINTCAP=/etc/lprng/printcap
SCRIPTNAME=/etc/init.d/$NAME

# Check for printcap file, if there isn't one, there is no need to start
test -f $PRINTCAP || test -f $LPDPRINTCAP || exit 0

# Do not start if there is no lpd or the lib dir is not there
test -f $DAEMON || test -d /usr/lib/lprng || exit 5

# Work out what port we are running on
LPD_PORT=$(sed '/^[[:space:]]*lpd_port/!d; s/.*[=#]\(.*\)/\1/; q' $CONFIGDIR/lpd.conf)
if [ -z $LPD_PORT ]
then
  LPD_PORT=515
fi

# Check lpd.conf for lockfile
LOCKFILE=$(sed '/^[[:space:]]*lockfile/!d; s/.*[=#]\(.*\)/\1/; q' $CONFIGDIR/lpd.conf)
if [ -z $LOCKFILE ]
then
  LOCKFILE=/var/run/lprng/lpd
fi

PIDFILE=$LOCKFILE.$LPD_PORT

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Source LSB script
. /lib/lsb/init-functions

if [ -r /etc/default/lprng ]; then
	. /etc/default/lprng
fi

initialise()
{
# Description
#   Runs checkpc and also checks we have the run directory
  RUNDIR=$(dirname ${PIDFILE})
  [ ! -d ${RUNDIR} ] && mkdir -p ${RUNDIR}
  checkpc -f > /dev/null || true
}

cleanup()
# description:
#   Removes all lock and control files on this host.
{
  rm -f "${PIDFILE}"

  for dir in $(find /var/spool/lpd/* -type d -print)
  do
    rm -f ${dir}/lock.pr
    rm -f ${dir}/control.pr
    rm -f ${dir}/unspooler.pr
  done
}

case "$1" in
  start)
	if [ "$START_LPD" != "yes" ]; then
    [ "$VERBOSE" != no ] && log_warning_msg "Not starting LPRng - edit /etc/default/lprng and change START_LPD to be yes."
		exit 0
    fi
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" lpd
	initialise
	if start-stop-daemon --start --quiet --pidfile "${PIDFILE}" \
		--exec $DAEMON ; then
		[ "$VERBOSE" != no ] && log_end_msg 0
	else
		[ "$VERBOSE" != no ] && log_end_msg 1
		exit 1
	fi
	;;
  stop)
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" lpd
	if start-stop-daemon --stop --oknodo --quiet --pidfile "${PIDFILE}" ; then
		cleanup
		[ "$VERBOSE" != no ] && log_end_msg 0
	else
		[ "$VERBOSE" != no ] && log_end_msg 1
		exit 1
	fi
	;;
  reload)
	 [ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC configuration files..."
	 if start-stop-daemon --stop --signal 1 --quiet --pidfile \
		"${PIDFILE}" --oknodo ; then
	 	[ "$VERBOSE" != no ] && log_end_msg 0
	else
		[ "$VERBOSE" != no ] && log_end_msg 1
		exit 1
	fi
  	;;
  restart|force-reload)
	[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" lpd
	start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" 
	sleep 1
	initialise
	start-stop-daemon --start --quiet --pidfile "${PIDFILE}" \
	    --exec $DAEMON
	[ "$VERBOSE" != no ] && log_end_msg 0
	;;
  *)
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

: