From 7b1fe3f5618c87c9f5b53185e4f58047474c1eba Mon Sep 17 00:00:00 2001 From: MonkWho <31880166+MonkWho@users.noreply.github.com> Date: Wed, 6 May 2020 04:00:45 -0700 Subject: [PATCH] Revert "Delete pfatt-5268AC" This reverts commit 611bc4d707867b271feb47cf790a4328fff4fded. --- bin/pfatt-5268AC | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 bin/pfatt-5268AC diff --git a/bin/pfatt-5268AC b/bin/pfatt-5268AC new file mode 100644 index 0000000..583f7cb --- /dev/null +++ b/bin/pfatt-5268AC @@ -0,0 +1,50 @@ +#!/bin/sh + +script_path="/root/bin/pfatt-5268AC.sh" + +name=`/usr/bin/basename "${script_path}"` + +rc_start() { + ### Lock out other start signals until we are done + /usr/bin/touch /var/run/${name}.lck + + ${script_path} & + pid=$! + + if [ $pid ]; then + echo $pid > /var/run/${name}.pid + /usr/bin/logger -p daemon.info -i -t pfattStartup "Successfully started ${name}" + else + /usr/bin/logger -p daemon.error -i -t pfattStartup "Error starting ${name}" + fi + + ### Remove the lock + if [ -f /var/run/${name}.lck ]; then + /bin/sleep 2 + /bin/rm /var/run/${name}.lck + fi +} + +rc_stop() { + if [ -f /var/run/${name}.pid ]; then + kill -9 `cat /var/run/${name}.pid` + /bin/rm /var/run/${name}.pid + fi +} + +case $1 in + start) + if [ ! -f /var/run/${name}.lck ]; then + rc_start + fi + ;; + stop) + rc_stop + ;; + restart) + if [ ! -f /var/run/${name}.lck ]; then + rc_stop + rc_start + fi + ;; +esac