]> git.pld-linux.org Git - packages/cups.git/commitdiff
- rewrited.
authorkloczek <kloczek@pld-linux.org>
Thu, 7 Dec 2000 10:21:12 +0000 (10:21 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    cups.init -> 1.2

cups.init

index 8bfd182cd34494666ad3280d0fd54bf655d7c6c6..5f183e94838bb282ba4c138c5005875d7ade4d74 100644 (file)
--- a/cups.init
+++ b/cups.init
 #!/bin/sh
 #
-# "$Id$"
 #
-#   Startup/shutdown script for the Common UNIX Printing System (CUPS).
+# cups         Common UNIX Printing System (CUPS)
 #
-#   Linux chkconfig stuff:
-#
-#   chkconfig: 0235 99 00
-#   description: Startup/shutdown script for the Common UNIX \
-#                Printing System (CUPS).
-#
-#   Copyright 1997-2000 by Easy Software Products, all rights reserved.
-#
-#   These coded instructions, statements, and computer programs are the
-#   property of Easy Software Products and are protected by Federal
-#   copyright law.  Distribution and use rights are outlined in the file
-#   "LICENSE.txt" which should have been included with this file.  If this
-#   file is missing or damaged please contact Easy Software Products
-#   at:
-#
-#       Attn: CUPS Licensing Information
-#       Easy Software Products
-#       44141 Airport View Drive, Suite 204
-#       Hollywood, Maryland 20636-3111 USA
-#
-#       Voice: (301) 373-9603
-#       EMail: cups-info@cups.org
-#         WWW: http://www.cups.org
+# chkconfig:   0235 99 00
+# description: Startup/shutdown script for the Common UNIX \
+#              Printing System (CUPS).
 #
 
-# See what program to use for configuration stuff...
-case "`uname`" in
-       IRIX*)
-               IS_ON=/sbin/chkconfig
-               ;;
+# Source function library
+. /etc/rc.d/init.d/functions
 
-       *)
-               IS_ON=/bin/true
-               ;;
-esac
-
-# The verbose flag controls the printing of the names of
-# daemons as they are started.
-if $IS_ON verbose; then
-       ECHO=echo
-else
-       ECHO=:
-fi
-
-# See if the CUPS server is running...
-case "`uname`" in
-       IRIX* | HP-UX | SunOS)
-               pid=`ps -e | awk '{print $1,$4}' | grep cupsd | awk '{print $1}'`
-               ;;
-       OSF1)
-               pid=`ps -e | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'`
-               ;;
-       Linux)
-               pid=`ps ax | awk '{print $1,$5}' | grep cupsd | awk '{print $1}'`
-               ;;
-       *)
-               pid=""
-               ;;
-esac
+# Get network config
+. /etc/sysconfig/network
 
-# Start or stop the CUPS server based upon the first argument to the script.
-case $1 in
-       start | restart | reload)
-               if test "$pid" != ""; then
-                       if $IS_ON cups; then
-                               kill -HUP $pid
-                               $ECHO "cups: scheduler restarted."
-                       else
-                               kill $pid
-                               $ECHO "cups: scheduler stopped."
-                       fi
-               else
-                       if $IS_ON cups; then
-                               prefix=/usr
-                               exec_prefix=/usr
-                               /usr/sbin/cupsd
-                               $ECHO "cups: scheduler started."
-                       fi
-               fi
-               ;;
+# Get service config - may override defaults
+[ -f /etc/sysconfig/cups ] && . /etc/sysconfig/cups
 
-       stop)
-               if test "$pid" != ""; then
-                       kill $pid
-                       $ECHO "cups: scheduler stopped."
-               fi
-               ;;
-
-       status)
-               if test "$pid" != ""; then
-                       echo "cups: Scheduler is running."
-               else
-                       echo "cups: Scheduler is not running."
-               fi
-               ;;
+# Check that networking is up.
+if is_no "${NETWORKING}"; then
+       msg_Network_Down CUPS
+       exit 1
+fi
 
-       *)
-               echo "Usage: cups {reload|restart|start|status|stop}"
+# See how we were called.
+case "$1" in
+  start)
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/cups ]; then
+               msg_starting CUPS
+               daemon cupsd
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cups
+       else
+               msg_Already_Running CUPS
                exit 1
-               ;;
-esac
-
-exit 0
+       fi
+        ;;
+  stop)
+        # Stop daemons.
+       if [ -f /var/lock/subsys/cups ]; then
+               msg_stopping CUPS
+               killproc cupsd
+               rm -f /var/lock/subsys/cups >/dev/null 2>&1
+       else
+               msg_Not_Running CUPS
+               exit 1
+       fi      
+        ;;
+  restart)
+        $0 stop
+       $0 start
+        ;;
+  reload)
+       if [ -f /var/lock/subsys/cups ]; then
+               msg_show CUPS
+               msg_reload
+               busy
+               killproc cupsd -HUP
+               deltext
+               ok              
+       else
+               msg_Not_Running CUPS
+               exit 1
+       fi
+       ;;
+  force-reload)
+       # if program allows reloading without stopping
+       $0 reload
+       exit $?
 
+       # or if it doesn't
+       $0 stop && $0 start
+       exit $?
+       ;;
+  status)
+       status cups
+       exit $?
+        ;;
+  *)
+        # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
+       msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
+        exit 1
+esac
 
-#
-# End of "$Id$".
-#
+exit $RETVAL
This page took 0.118723 seconds and 4 git commands to generate.