Package: lpr
Version: 1:2008.05.17
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: initd-status-support
Here is a patch to support the "status" action in the init.d script. (If you
ever want to switch to using the lsb-base functions, the patch becomes much
easier.)
diff -Nru lpr-2008.05.17/debian/lpd.init lpr-2008.05.18/debian/lpd.init
--- lpr-2008.05.17/debian/lpd.init 2006-08-04 01:54:16.000000000 +0300
+++ lpr-2008.05.18/debian/lpd.init 2009-05-09 10:35:37.000000000 +0300
@@ -48,8 +48,22 @@
sleep 1
$0 start
;;
+ status)
+ pid=`cat /var/run/lpd.pid 2>/dev/null` || true
+ if test ! -f /var/run/lpd.pid -o -z "$pid"; then
+ echo "lpd is not running"
+ exit 3
+ fi
+ if ps "$pid" >/dev/null 2>&1; then
+ echo "lpd is running"
+ exit 0
+ else
+ echo "lpd is not running"
+ exit 1
+ fi
+ ;;
*)
- echo "Usage: /etc/init.d/lpd {start|stop|restart|force-reload}"
+ echo "Usage: /etc/init.d/lpd {start|stop|restart|force-reload|status}"
exit 1
esac