From 9e55fd2c76ad7a2f2d532e2101388b5628bbfee0 Mon Sep 17 00:00:00 2001 From: Artem Stepanov Date: Tue, 5 Jul 2016 16:21:23 +0300 Subject: [PATCH] Added ctl script for RedHat linux. --- nginx-ldap-auth-daemon-ctl-rh.sh | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 nginx-ldap-auth-daemon-ctl-rh.sh diff --git a/nginx-ldap-auth-daemon-ctl-rh.sh b/nginx-ldap-auth-daemon-ctl-rh.sh new file mode 100755 index 0000000..af647ac --- /dev/null +++ b/nginx-ldap-auth-daemon-ctl-rh.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +CMD=nginx-ldap-auth-daemon.py +if [ ! -f "$CMD" ]; then + echo "Please run '$0' from the same directory where '$CMD' file resides" + exit 1 +fi + +CMD=$PWD/$CMD +PIDFILE=./nginx-ldap-auth-daemon.pid + +. /etc/init.d/functions + +start() { + echo -n "Starting ldap-auth-daemon: " + if [ -s ${PIDFILE} ]; then + RETVAL=1 + echo -n "Already running !" && warning + echo + else + nohup ${CMD} >/dev/null 2>&1 & + RETVAL=$? + PID=$! + [ $RETVAL -eq 0 ] && success || failure + echo + echo $PID > ${PIDFILE} + fi +} + +case $1 in + "start") + start + ;; + "stop") + echo -n "Stopping ldap-auth-daemon: " + killproc -p $PIDFILE $CMD + echo + ;; + *) + echo "Usage: $0 " + ;; +esac