1#!/bin/sh 2# Provides: cups-browsed 3# Required-Start: $local_fs $remote_fs $network $named $time $cups 4# Required-Stop: $local_fs $remote_fs $network $named $time $cups 5# Should-Start: $avahi-daemon 6# Should-Stop: $avahi-daemon 7# Default-Start: 2 3 4 5 8# Default-Stop: 0 1 6 9# Short-Description: cups-browsed - Make remote CUPS printers available locally 10# Description: This daemon browses Bonjour broadcasts of shared remote CUPS 11# printers and makes these printers available locally by creating 12# local CUPS queues pointing to the remote queues. This replaces 13# the CUPS browsing which was dropped in CUPS 1.6.1. For the end 14# the behavior is the same as with the old CUPS broadcasting/ 15# browsing, but in the background the standard method for network 16# service announcement and discovery, Bonjour, is used. 17### END INIT INFO 18 19# 20# Linux chkconfig stuff: 21# 22# chkconfig: 235 99 00 23# description: Startup/shutdown script for cups-browsed. 24# 25 26# 27# NetBSD 1.5+ rcorder script lines. The format of the following two 28# lines is very strict -- please don't add additional spaces! 29# 30# PROVIDE: cups-browsed 31# REQUIRE: cups 32# 33 34 35#### OS-Dependent Configuration 36 37case "`uname`" in 38 *BSD*) 39 IS_ON=: 40 ECHO=echo 41 ECHO_OK=: 42 ECHO_ERROR=: 43 ;; 44 45 Darwin*) 46 . /etc/rc.common 47 48 if test "${CUPS_BROWSED:=-YES-}" = "-NO-"; then 49 exit 0 50 fi 51 52 IS_ON=: 53 ECHO=ConsoleMessage 54 ECHO_OK=: 55 ECHO_ERROR=: 56 ;; 57 58 Linux*) 59 IS_ON=/bin/true 60 if test -f /etc/init.d/functions; then 61 . /etc/init.d/functions 62 ECHO=echo 63 ECHO_OK="echo_success" 64 ECHO_ERROR="echo_failure" 65 else 66 ECHO=echo 67 ECHO_OK=: 68 ECHO_ERROR=: 69 fi 70 ;; 71 72 *) 73 IS_ON=/bin/true 74 ECHO=echo 75 ECHO_OK=: 76 ECHO_ERROR=: 77 ;; 78esac 79 80# 81# Make sure we have the standard program directories in the path 82# since some operating systems (this means YOU HP-UX!) don't 83# provide a standard path on boot-up... 84# 85 86if test "x$PATH" = x; then 87 PATH="/bin:/usr/bin:/sbin:/usr/sbin" 88else 89 PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH" 90fi 91 92export PATH 93 94# 95# See if the CUPS server (cupsd) is running... 96# 97 98case "`uname`" in 99 Linux* | *BSD* | Darwin*) 100 pid=`ps ax | awk '{if (match($5, ".*/cups-browsed$") || $5 == "cups-browsed") print $1}'` 101 ;; 102 *) 103 pid="" 104 ;; 105esac 106 107# 108# Start or stop cups-browsed based upon the first argument to the script. 109# 110 111case $1 in 112 start | restart | reload) 113 if $IS_ON cups; then 114 if test "$pid" != ""; then 115 kill -TERM $pid 116 fi 117 prefix=@prefix@ 118 exec_prefix=@exec_prefix@ 119 @sbindir@/cups-browsed & 120 if test $? != 0; then 121 $ECHO_FAIL 122 $ECHO "cups-browsed: unable to $1." 123 exit 1 124 fi 125 $ECHO_OK 126 $ECHO "cups-browsed: ${1}ed." 127 fi 128 ;; 129 130 stop) 131 if test "$pid" != ""; then 132 kill -TERM $pid 133 $ECHO_OK 134 $ECHO "cups-browsed: stopped." 135 fi 136 ;; 137 138 status) 139 if test "$pid" != ""; then 140 echo "cups-browsed: running." 141 else 142 echo "cups-browsed: not running." 143 fi 144 ;; 145 146 *) 147 echo "Usage: cups-browsed {reload|restart|start|status|stop}" 148 exit 1 149 ;; 150esac 151 152# 153# Exit with no errors. 154# 155 156exit 0 157