Mercurial > vanilla
comparison print/cups/cupsd @ 700:98351d3f57eb
print/cups: initial import, closes #1232
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 02 Aug 2019 20:10:00 +0200 |
parents | |
children | 3dfef64b81c1 |
comparison
equal
deleted
inserted
replaced
699:8182d6faba08 | 700:98351d3f57eb |
---|---|
1 #!/bin/sh | |
2 # | |
3 # /etc/rc.d/cupsd -- run control script for cupsd | |
4 # | |
5 # Copyright (c) 2019 David Demelier <markand@malikania.fr> | |
6 # | |
7 # Permission to use, copy, modify, and/or distribute this software for any | |
8 # purpose with or without fee is hereby granted, provided that the above | |
9 # copyright notice and this permission notice appear in all copies. | |
10 # | |
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 # | |
19 | |
20 if [ -f /etc/rc.conf ]; then | |
21 . /etc/rc.conf | |
22 fi | |
23 | |
24 : ${TEMPLATE_CMD:=/bin/cupsd} | |
25 : ${TEMPLATE_ARGS:=} | |
26 : ${TEMPLATE_PID:=/var/run/cups/cupsd.pid} | |
27 | |
28 cupsd_start() | |
29 { | |
30 echo "Starting cupsd: $TEMPLATE_CMD $TEMPLATE_ARGS" | |
31 $TEMPLATE_CMD $TEMPLATE_ARGS -p $TEMPLATE_PID | |
32 } | |
33 | |
34 cupsd_status() | |
35 { | |
36 if [ -s $TEMPLATE_PID ]; then | |
37 echo "cupsd is running with pid: $(cat $TEMPLATE_PID)" | |
38 else | |
39 echo "cupsd is not running" | |
40 fi | |
41 } | |
42 | |
43 cupsd_stop() | |
44 { | |
45 if [ -s $TEMPLATE_PID ]; then | |
46 echo "Stopping cupsd." | |
47 kill -QUIT $(cat $TEMPLATE_PID) | |
48 fi | |
49 } | |
50 | |
51 cupsd_restart() | |
52 { | |
53 cupsd_stop | |
54 sleep 3 | |
55 cupsd_start | |
56 } | |
57 | |
58 case $1 in | |
59 start) | |
60 cupsd_start | |
61 ;; | |
62 status) | |
63 cupsd_status | |
64 ;; | |
65 stop) | |
66 cupsd_stop | |
67 ;; | |
68 restart) | |
69 cupsd_restart | |
70 ;; | |
71 *) | |
72 echo "usage: $(basename $0) restart|start|status|stop" | |
73 ;; | |
74 esac |