3
# hplip initscript for the HP Linux Printing and Imaging System
4
# Copr. 2004 by Henrique de Moraes Holschuh <hmh@debian.org>
6
# $Id: hplip.init,v 1.9 2005/01/21 14:41:15 hmh Exp $
8
PATH=/sbin:/bin:/usr/sbin:/usr/bin
9
DESC="HP Linux Printing and Imaging System"
10
DESC1="HP Linux Printing and Imaging System GUIs"
12
DAEMON1=/usr/sbin/hpiod
15
PIDFILE1=/var/run/hpiod.pid
17
DAEMON2=/usr/sbin/hpssd
20
PIDFILE2=/var/run/hpssd.pid
24
[ -r /etc/default/hplip ] && . /etc/default/hplip
26
test -f ${DAEMON1} || exit 0
33
if [ ${DIDSOMETHING} -ne 0 ] ; then
34
# Tell cupsys that we (may) have a new ative backend
35
# be silent about it to avoid unneeded hassles duing
36
# shutdowns -- it is not like we care if this suceeds or
38
if [ -x /usr/sbin/invoke-rc.d ] ; then
39
invoke-rc.d cupsys reload >/dev/null 2>&1 || true
41
/etc/init.d/cupsys reload >/dev/null 2>&1 || true
48
start-stop-daemon --stop --pidfile "$1" --name "python" --quiet && {
50
echo -n $(basename "$1" | sed -e 's/.pid//')
56
echo -n "Stopping ${DESC1}: "
57
find /var/run -type f -name 'hpguid-*.pid' -print | \
58
while read -r i ; do stop_hpuid "$i" ; done
69
START="--start --quiet --pidfile ${PIDFILE} --startas ${DAEMON} --name ${PROCNAME}"
70
[ -n "${DAEMONOPT}" ] && START="${START} -- ${DAEMONOPT}"
71
if start-stop-daemon ${START} >/dev/null 2>&1 ; then
75
if start-stop-daemon --test ${START} >/dev/null 2>&1; then
76
echo -n "(${NAME} failed)"
79
echo -n "(${NAME} already running)"
92
# yes, it is --start. go read the manpage
93
STOP="--start --quiet --pidfile ${PIDFILE} --startas ${DAEMON} --name ${PROCNAME}"
95
if start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
96
--retry 10 --name ${PROCNAME} \
97
>/dev/null 2>&1 ; then
100
# FIXME: change hpiod so that this is not necessary
103
if start-stop-daemon --test ${STOP} >/dev/null 2>&1; then
104
echo -n "(${NAME} not running)"
107
echo -n "(${NAME} failed)"
115
echo -n "Starting $DESC: "
116
if start_daemon "${DAEMON1}" "${PIDFILE1}" "${NAME1}" \
117
"${PROCNAME1}" "${HPIODOPTIONS}" && \
119
start_daemon "${DAEMON2}" "${PIDFILE2}" "${NAME2}" \
120
"${PROCNAME2}" "${HPSSDOPTIONS}"; then
131
echo -n "Stopping $DESC: "
132
if stop_daemon "${DAEMON2}" "${PIDFILE2}" "${NAME2}" \
133
"${PROCNAME2}" ; then
135
stop_daemon "${DAEMON1}" "${PIDFILE1}" "${NAME1}" \
136
"${PROCNAME1}" && echo && return 0
141
stop_daemon "${DAEMON1}" "${PIDFILE1}" "${NAME1}" \
159
restart|force-reload)
166
echo "Usage: $0 {start|stop|restart|force-reload}" 1>&2