diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-12-23 13:57:12 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-12-23 13:57:12 -0500 |
commit | 8b46da37a3d01169292b7982818947a4219e1bec (patch) | |
tree | 41af66c556c4cdd42cf0a8512275f38c816eed6a /libre/cups-libre/cups | |
parent | 8b024219267fe0dfe3a251ff966af66a1fd23d7b (diff) | |
parent | f7ad7579f473125b44db30248841e2d452f9547e (diff) |
Merge branch 'master' of ssh://parabolagnulinux.org:1863/abslibre
Diffstat (limited to 'libre/cups-libre/cups')
-rw-r--r-- | libre/cups-libre/cups | 69 |
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 + |