#!/bin/bash # Startup/shutdown script for HPLIP # # Note, this script file must start before cupsd. # . /etc/rc.conf . /etc/rc.d/functions PID=`pidof -o %PPID /usr/sbin/hpiod` PID2=`pidof -o %PPID python /usr/share/hplip/hpssd.py` case "$1" in start) #Check for running portmap, start when not running ck_daemon portmap && /etc/rc.d/portmap start stat_busy "Starting hpiod: " [ -z "$PID" ] && /usr/sbin/hpiod > /dev/null 2>&1 if [ $? -gt 0 ]; then stat_fail else echo $PID > /var/run/hpiod.pid add_daemon hpiod stat_done fi stat_busy "Starting hpssd: " [ -z "$PID2" ] && python /usr/share/hplip/hpssd.py > /dev/null 2>&1 if [ $? -gt 0 ]; then stat_fail else echo $PID2 > /var/run/hpssd.pid add_daemon hpssd stat_done fi ;; stop) stat_busy "Stopping hpiod: " [ ! -z "$PID" ] && kill $PID &> /dev/null if [ $? -gt 0 ]; then stat_fail else rm /var/run/hpiod.pid rm_daemon hpiod stat_done fi stat_busy "Stopping hpssd: " [ ! -z "$PID2" ] && kill $PID2 &> /dev/null if [ $? -gt 0 ]; then stat_fail else rm /var/run/hpssd.pid rm_daemon hpssd stat_done fi ;; restart) $0 stop sleep 1 $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac exit 0