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 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
#!/bin/sh
# Provides: cups-browsed
# Required-Start: $local_fs $remote_fs $network $named $time $cups
# Required-Stop: $local_fs $remote_fs $network $named $time $cups
# Should-Start: $avahi-daemon
# Should-Stop: $avahi-daemon
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: cups-browsed - Make remote CUPS printers available locally
# Description: This daemon browses Bonjour broadcasts of shared remote CUPS
# printers and makes these printers available locally by creating
# local CUPS queues pointing to the remote queues. This replaces
# the CUPS browsing which was dropped in CUPS 1.6.1. For the end
# the behavior is the same as with the old CUPS broadcasting/
# browsing, but in the background the standard method for network
# service announcement and discovery, Bonjour, is used.
### END INIT INFO
#
# Linux chkconfig stuff:
#
# chkconfig: 235 99 00
# description: Startup/shutdown script for cups-browsed.
#
#
# NetBSD 1.5+ rcorder script lines. The format of the following two
# lines is very strict -- please don't add additional spaces!
#
# PROVIDE: cups-browsed
# REQUIRE: cups
#
#### OS-Dependent Configuration
case "`uname`" in
*BSD*)
IS_ON=:
ECHO=echo
ECHO_OK=:
ECHO_ERROR=:
;;
Darwin*)
. /etc/rc.common
if test "${CUPS_BROWSED:=-YES-}" = "-NO-"; then
exit 0
fi
IS_ON=:
ECHO=ConsoleMessage
ECHO_OK=:
ECHO_ERROR=:
;;
Linux*)
IS_ON=/bin/true
if test -f /etc/init.d/functions; then
. /etc/init.d/functions
ECHO=echo
ECHO_OK="echo_success"
ECHO_ERROR="echo_failure"
else
ECHO=echo
ECHO_OK=:
ECHO_ERROR=:
fi
;;
*)
IS_ON=/bin/true
ECHO=echo
ECHO_OK=:
ECHO_ERROR=:
;;
esac
#
# Make sure we have the standard program directories in the path
# since some operating systems (this means YOU HP-UX!) don't
# provide a standard path on boot-up...
#
if test "x$PATH" = x; then
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
else
PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
fi
export PATH
#
# See if the CUPS server (cupsd) is running...
#
case "`uname`" in
Linux* | *BSD* | Darwin*)
pid=`ps ax | awk '{if (match($5, ".*/cups-browsed$") || $5 == "cups-browsed") print $1}'`
;;
*)
pid=""
;;
esac
#
# Start or stop cups-browsed based upon the first argument to the script.
#
case $1 in
start | restart | reload)
if $IS_ON cups; then
if test "$pid" != ""; then
kill -TERM $pid
fi
prefix=@prefix@
exec_prefix=@exec_prefix@
@sbindir@/cups-browsed &
if test $? != 0; then
$ECHO_FAIL
$ECHO "cups-browsed: unable to $1."
exit 1
fi
$ECHO_OK
$ECHO "cups-browsed: ${1}ed."
fi
;;
stop)
if test "$pid" != ""; then
kill -TERM $pid
$ECHO_OK
$ECHO "cups-browsed: stopped."
fi
;;
status)
if test "$pid" != ""; then
echo "cups-browsed: running."
else
echo "cups-browsed: not running."
fi
;;
*)
echo "Usage: cups-browsed {reload|restart|start|status|stop}"
exit 1
;;
esac
#
# Exit with no errors.
#
exit 0
|