From f4e689d9f1007e93c44cebad55f65e3b34bd23bd Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Tue, 20 Dec 2011 17:43:11 -0300 Subject: libre/cups-libre-1.5.0-1 --- libre/cups-libre/cups | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 libre/cups-libre/cups (limited to 'libre/cups-libre/cups') diff --git a/libre/cups-libre/cups b/libre/cups-libre/cups new file mode 100644 index 000000000..a9d91de76 --- /dev/null +++ b/libre/cups-libre/cups @@ -0,0 +1,69 @@ +#!/bin/bash + +daemon_name=cupsd + +. /etc/rc.conf +. /etc/rc.d/functions +#. /etc/conf.d/$daemon_name.conf + +get_pid() { + pidof -o %PPID $daemon_name +} + +case "$1" in + start) + stat_busy "Starting $daemon_name daemon" + + PID=$(get_pid) + if [ -z "$PID" ]; then + [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid + # RUN + $daemon_name + # + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + echo $(get_pid) > /var/run/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping $daemon_name daemon" + PID=$(get_pid) + # KILL + [ ! -z "$PID" ] && kill $PID &> /dev/null + # + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" +esac + +exit 0 + -- cgit v1.2.3-54-g00ecf