1#!/bin/sh 2 3DAEMON="cupsd" 4PIDFILE="/var/run/$DAEMON.pid" 5 6start() { 7 printf 'Starting %s: ' "$DAEMON" 8 # shellcheck disable=SC2086 # we need the word splitting 9 start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ 10 -- -C /etc/cups/cupsd.conf -s /etc/cups/cups-files 11 status=$? 12 if [ "$status" -eq 0 ]; then 13 echo "OK" 14 else 15 echo "FAIL" 16 fi 17 return "$status" 18} 19 20stop() { 21 printf 'Stopping %s: ' "$DAEMON" 22 start-stop-daemon -K -q -p "$PIDFILE" 23 status=$? 24 if [ "$status" -eq 0 ]; then 25 rm -f "$PIDFILE" 26 echo "OK" 27 else 28 echo "FAIL" 29 fi 30 return "$status" 31} 32 33restart() { 34 stop 35 sleep 1 36 start 37} 38 39case "$1" in 40 start|stop|restart) 41 "$1";; 42 reload) 43 # Restart, since there is no true "reload" feature. 44 restart;; 45 *) 46 echo "Usage: $0 {start|stop|restart|reload}" 47 exit 1 48esac 49