aboutsummaryrefslogtreecommitdiff
path: root/init/slackware
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-02-14 16:07:19 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-02-14 16:10:39 +0200
commit2d2e9e1fdadb5af7bfd5a2a77500218b592034e1 (patch)
tree01aab262490eeff1dcea109767719ba1f84b50fc /init/slackware
parentfe4dd5c7fe77591ee8d7780d3f5e2e9b9334c2c5 (diff)
downloadvarnish-mib-2d2e9e1fdadb5af7bfd5a2a77500218b592034e1.tar.gz
varnish-mib-2d2e9e1fdadb5af7bfd5a2a77500218b592034e1.tar.bz2
Version 4.0release-4.0
* Makefile.am: Add init. * NEWS: Update. * README: Mention initialization files from init. * configure.ac: Version 4.0 * init/README: New file. * init/debian: New file. * init/rh: New file. * init/slackware: New file. * init/slackware.genrc: New file. * init/varnish-mib.service: New file. * src/main.c: Minor fixes.
Diffstat (limited to 'init/slackware')
-rwxr-xr-xinit/slackware76
1 files changed, 76 insertions, 0 deletions
diff --git a/init/slackware b/init/slackware
new file mode 100755
index 0000000..db735ea
--- /dev/null
+++ b/init/slackware
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+DAEMON=/usr/sbin/varnish-mib
+PIDFILE=/var/run/varnish-mib.pid
+OPTIONS=
+
+# 0 - running
+# 1 - not running
+# 2 - in doubt
+varnish_mib_is_running() {
+ if [ -f $PIDFILE ]; then
+ if [ ! -r $PIDFILE ]; then
+ diag="probably running; $PIDFILE exists, but is not readable"
+ return 2
+ else
+ pid=$(head -n 1 $PIDFILE)
+ if [ -z "$pid" ]; then
+ diag="can't read $PIDFILE"
+ return 2
+ else
+ if kill -0 $pid; then
+ diag="$DAEMON running (pid $pid)"
+ return 0
+ else
+ diag="stale pidfile $PIDFILE"
+ rm $PIDFILE
+ return 2
+ fi
+ fi
+ fi
+ else
+ diag="$DAEMON not running"
+ return 1
+ fi
+}
+
+varnish_mib_status() {
+ varnish_mib_is_running
+ echo $diag
+ exit $?
+}
+
+varnish_mib_start() {
+ if varnish_mib_is_running; then
+ echo $diag
+ else
+ $DAEMON $OPTIONS -p $PIDFILE
+ fi
+}
+
+varnish_mib_stop() {
+ if varnish_mib_is_running; then
+ kill -TERM $pid
+ sleep 2
+ if [ -r $PIDFILE ]; then
+ kill -9 $pid
+ rm -f $PIDFILE;
+ fi
+ else
+ echo $diag
+ fi
+}
+
+case "$1" in
+ start)
+ varnish_mib_start;;
+ stop)
+ varnish_mib_stop;;
+ restart)
+ varnish_mib_restart;;
+ status)
+ varnish_mib_status;;
+ *)
+ echo "usage: $0 start|stop|restart|status"
+esac
+

Return to:

Send suggestions and report system problems to the System administrator.