4 # Required-Start: $syslog $remote_fs
5 # Required-Stop: $syslog $remote_fs
6 # Should-Start: $network avahi
7 # Should-Stop: $network
8 # X-Start-Before: samba
10 # Default-Start: 2 3 4 5
12 # Short-Description: CUPS Printing spooler and server
15 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
16 DAEMON=/usr/sbin/cupsd
18 PIDFILE=/var/run/cups/$NAME.pid
19 DESC="Common Unix Printing System"
23 test -x $DAEMON || exit 0
25 mkdir -p /var/run/cups/certs
27 if [ -r /etc/default/cups ]; then
31 . /lib/lsb/init-functions
33 # Get the timezone set.
34 if [ -z "$TZ" -a -e /etc/timezone ]; then
35 TZ=`cat /etc/timezone`
40 if [ -n "$success" ] && [ -x /etc/init.d/xprint ]; then
41 invoke-rc.d xprint force-reload || true
45 coldplug_usb_printers() {
46 if type udevadm > /dev/null 2>&1 && [ -x /lib/udev/udev-configure-printer ]; then
47 for printer in `udevadm trigger --verbose --dry-run --subsystem-match=usb \
48 --attr-match=bInterfaceClass=07 --attr-match=bInterfaceSubClass=01 2>/dev/null || true; \
49 udevadm trigger --verbose --dry-run --subsystem-match=usb \
50 --sysname-match='lp[0-9]*' 2>/dev/null || true`; do
51 /lib/udev/udev-configure-printer add "${printer#/sys}"
58 log_begin_msg "Starting $DESC: $NAME"
60 mkdir -p `dirname "$PIDFILE"`
61 if [ "$LOAD_LP_MODULE" = "yes" -a -f /usr/lib/cups/backend/parallel \
62 -a -f /proc/devices -a -f /proc/modules -a -x /sbin/modprobe ]; then
63 modprobe -q -b lp || true
64 modprobe -q -b ppdev || true
65 modprobe -q -b parport_pc || true
68 start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" --exec $DAEMON && success=1
75 log_begin_msg "Stopping $DESC: $NAME"
76 start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME && success=1
81 log_begin_msg "Reloading $DESC: $NAME"
82 start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME --signal 1 && success=1
87 log_begin_msg "Restarting $DESC: $NAME"
88 if start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME; then
89 start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON && success=1
95 echo -n "Status of $DESC: "
96 if [ ! -r "$PIDFILE" ]; then
97 echo "$NAME is not running."
100 if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
101 echo "$NAME is running."
104 echo "$NAME is not running but $PIDFILE exists."
109 N=/etc/init.d/${0##*/}
110 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2