hplip/rchplip

102 lines
1.9 KiB
Bash

#! /bin/bash
### BEGIN INIT INFO
# Provides: hplip
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Since HPLIP 2.8.4 hpssd is gone. Stop it in any case.
# Description: Stop hpssd from HP Linux Imaging and Printing (HPLIP)
### END INIT INFO
RUNDIR=/var/run
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
else
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
export LC_ALL="POSIX"
export LANG="POSIX"
export HOME="/tmp"
umask 022
killproc() {
pid=`pidof -s $1`
pidfile=$RUNDIR/${1}.pid
if [ -z $pid ]; then
if [ -f $pidfile ]; then
read pid < $pidfile
kill $pid
fi
else
kill $pid
fi
retval=$?
if [ -f $pidfile ]; then
rm $pidfile
fi
if [ $retval -eq 0 ]; then
echo -ne " [ OK ]\r"
else
echo -ne " [FAILED]\r"
fi
}
fi
RETVAL=0
stop() {
echo -n $"Since HPLIP 2.8.4 hpssd is gone. Stopping it in any case: "
killproc hpssd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/hplip
for pidfile in $RUNDIR/*; do
case "$( basename $pidfile )" in
hpguid-*.pid)
read pid < $pidfile
kill $pid
rm $pidfile
esac
done
if [ ! -f /var/lock/subsys/hplip ]; then
rm -f /var/lock/subsys/hplip
fi
return 0
}
case "$1" in
start)
stop
;;
stop)
stop
;;
status)
stop
;;
restart)
stop
;;
try-restart)
stop
;;
force-reload)
stop
;;
debug)
stop
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 1
esac
exit $?