summaryrefslogtreecommitdiff
path: root/libre/cups-libre/cups
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-12-20 17:43:11 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2011-12-20 17:43:11 -0300
commitf4e689d9f1007e93c44cebad55f65e3b34bd23bd (patch)
tree0970408a884429fea0b5c388e98bb9e9b109c3fd /libre/cups-libre/cups
parent64af7fa36cf19a2ef627bd20f8f3b62feef94c6c (diff)
libre/cups-libre-1.5.0-1
Diffstat (limited to 'libre/cups-libre/cups')
-rw-r--r--libre/cups-libre/cups69
1 files changed, 69 insertions, 0 deletions
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
+