From 4b85f9c9fddeb40b708999b795f9e0d78259602a Mon Sep 17 00:00:00 2001 From: Derek Macias Date: Mon, 21 Dec 2015 00:06:42 -0700 Subject: [PATCH] add start and stop checks --- .../plugins/ipmitool-plugin/scripts/start | 51 ++++++++++--------- .../plugins/ipmitool-plugin/scripts/stop | 3 -- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/start b/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/start index 6a2bf32e..29909457 100755 --- a/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/start +++ b/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/start @@ -1,35 +1,38 @@ #!/bin/sh # read our configuration -source /boot/config/plugins/ipmitool-plugin/ipmitool-plugin.cfg - prog="ipmievd" prog2="ipmitail" IPMIEVD="/usr/sbin/$prog" IPMITAIL="/usr/local/emhttp/plugins/ipmitool-plugin/scripts/$prog2" LOCKFILE="/var/lock/$prog" PIDFILE="/var/run/$prog.pid0" -CONFIG="/boot/config/plugins/ipmitool-plugin" +CONFIG="/boot/config/plugins/ipmitool-plugin/ipmitool-plugin.cfg" OPTIONS="" -# no-op if already running -if [ ! -r $PIDFILE ]; then - if [ $REMOTE == "enable" ]; then - OPTIONS="-I lanplus -H $IPADDR -U $USER -P $(echo $PASSWORD | base64 --decode)" - fi - sleep 1 +if [ -e $CONFIG ]; then + source $CONFIG + if [ $SERVICE == "enable" ]; then + # no-op if already running + if [ ! -r $PIDFILE ]; then + if [ $REMOTE == "enable" ]; then + OPTIONS="-I lanplus -H $IPADDR -U $USER -P $(echo $PASSWORD | base64 --decode)" + fi + sleep 1 - nohup $IPMIEVD sel $OPTIONS > /dev/null 2>&1 | logger -tipmitool & - touch $LOCKFILE - TIMER=0 - while [ ! -e $PIDFILE ]; do - sleep 1 - let TIMER=$TIMER+1 - if [ $TIMER -gt 5 ]; then - echo -n "$PIDFILE not created" - break - fi - done - if [ -r $PIDFILE ]; then - nohup $IPMITAIL >/dev/null 2>&1 < /dev/null & - fi -fi + nohup $IPMIEVD sel $OPTIONS > /dev/null 2>&1 | logger -tipmitool & + touch $LOCKFILE + TIMER=0 + while [ ! -e $PIDFILE ]; do + sleep 1 + let TIMER=$TIMER+1 + if [ $TIMER -gt 5 ]; then + echo -n "$PIDFILE not created" + break + fi + done + if [ -r $PIDFILE ]; then + nohup $IPMITAIL >/dev/null 2>&1 < /dev/null & + fi + fi + fi +fi \ No newline at end of file diff --git a/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/stop b/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/stop index 82f36f7d..118d79e8 100755 --- a/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/stop +++ b/source/ipmitool-plugin/usr/local/emhttp/plugins/ipmitool-plugin/scripts/stop @@ -1,7 +1,4 @@ #!/bin/sh -# read our configuration -source /boot/config/plugins/ipmitool-plugin/ipmitool-plugin.cfg - prog="ipmievd" prog2="ipmitail" LOCKFILE="/var/lock/$prog"