#!/bin/sh
. /etc/rc.common
StartService ()
{
if [ "${CUPS:=-YES-}" = "-YES-" ]; then
ConsoleMessage "Starting printing services"
/usr/sbin/cupsd
fi
}
StopService ()
{
pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
if test "$pid" != ""; then
ConsoleMessage "Stopping printing services"
kill "${pid}"
fi
}
RestartService ()
{
pid=`ps ax | awk '{if (match($5, ".*/cupsd$") || $5 == "cupsd") print $1}'`
if test "x$pid" != x; then
ConsoleMessage "Restarting printing services"
kill -HUP "${pid}"
else
StartService
fi
}
RunService "$1"