]> git.pld-linux.org Git - packages/cups.git/blame - cups.init
- added nolibs patch to remove unnecessary -lnsl; release 3
[packages/cups.git] / cups.init
CommitLineData
2f6a95a5 1#!/bin/sh
2#
2f6a95a5 3#
48216a6a 4# cups Common UNIX Printing System (CUPS)
2f6a95a5 5#
17b43d09 6# chkconfig: 235 95 00
48216a6a 7# description: Startup/shutdown script for the Common UNIX \
8# Printing System (CUPS).
2f6a95a5 9#
10
48216a6a 11# Source function library
12. /etc/rc.d/init.d/functions
2f6a95a5 13
48216a6a 14# Get network config
15. /etc/sysconfig/network
2f6a95a5 16
48216a6a 17# Get service config - may override defaults
18[ -f /etc/sysconfig/cups ] && . /etc/sysconfig/cups
2f6a95a5 19
48216a6a 20# Check that networking is up.
b4cbd825 21if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network ]; then
23 msg_network_down CUPS
24 exit 1
25 fi
26else
27 exit 0
48216a6a 28fi
2f6a95a5 29
48216a6a 30# See how we were called.
31case "$1" in
32 start)
33 # Check if the service is already running?
f6feb0d3 34 if [ ! -f /var/lock/subsys/cupsd ]; then
48216a6a 35 msg_starting CUPS
78986dfa 36 daemon cupsd -c /etc/cups/cupsd.conf
48216a6a 37 RETVAL=$?
f6feb0d3 38 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cupsd
48216a6a 39 else
44be047c 40 msg_already_running CUPS
2f6a95a5 41 exit 1
48216a6a 42 fi
5995ec5d 43 ;;
48216a6a 44 stop)
5995ec5d 45 # Stop daemons.
f6feb0d3 46 if [ -f /var/lock/subsys/cupsd ]; then
48216a6a 47 msg_stopping CUPS
48 killproc cupsd
f6feb0d3 49 rm -f /var/lock/subsys/cupsd >/dev/null 2>&1
48216a6a 50 else
44be047c 51 msg_not_running CUPS
48216a6a 52 exit 1
53 fi
5995ec5d 54 ;;
48216a6a 55 restart)
5995ec5d 56 $0 stop
48216a6a 57 $0 start
5995ec5d 58 ;;
48216a6a 59 reload)
f6feb0d3 60 if [ -f /var/lock/subsys/cupsd ]; then
e5676d4c 61 msg_reloading CUPS
48216a6a 62 killproc cupsd -HUP
b4cbd825 63 RETVAL=$?
48216a6a 64 else
44be047c 65 msg_not_running CUPS
48216a6a 66 exit 1
67 fi
68 ;;
69 force-reload)
70 # if program allows reloading without stopping
71 $0 reload
72 exit $?
2f6a95a5 73
48216a6a 74 # or if it doesn't
75 $0 stop && $0 start
76 exit $?
77 ;;
78 status)
f6feb0d3 79 status cupsd
48216a6a 80 exit $?
5995ec5d 81 ;;
48216a6a 82 *)
5995ec5d 83 # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
84 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
85 exit 1
48216a6a 86esac
2f6a95a5 87
48216a6a 88exit $RETVAL
This page took 0.045404 seconds and 4 git commands to generate.