Mercurial > vanilla
view print/cups/cupsd @ 993:2cdbc5f913f0
kde/kactivities: initial import, closes #1786
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 28 Aug 2019 20:48:00 +0200 |
parents | 98351d3f57eb |
children | 3dfef64b81c1 |
line wrap: on
line source
#!/bin/sh # # /etc/rc.d/cupsd -- run control script for cupsd # # Copyright (c) 2019 David Demelier <markand@malikania.fr> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # if [ -f /etc/rc.conf ]; then . /etc/rc.conf fi : ${TEMPLATE_CMD:=/bin/cupsd} : ${TEMPLATE_ARGS:=} : ${TEMPLATE_PID:=/var/run/cups/cupsd.pid} cupsd_start() { echo "Starting cupsd: $TEMPLATE_CMD $TEMPLATE_ARGS" $TEMPLATE_CMD $TEMPLATE_ARGS -p $TEMPLATE_PID } cupsd_status() { if [ -s $TEMPLATE_PID ]; then echo "cupsd is running with pid: $(cat $TEMPLATE_PID)" else echo "cupsd is not running" fi } cupsd_stop() { if [ -s $TEMPLATE_PID ]; then echo "Stopping cupsd." kill -QUIT $(cat $TEMPLATE_PID) fi } cupsd_restart() { cupsd_stop sleep 3 cupsd_start } case $1 in start) cupsd_start ;; status) cupsd_status ;; stop) cupsd_stop ;; restart) cupsd_restart ;; *) echo "usage: $(basename $0) restart|start|status|stop" ;; esac