add start and stop checks

This commit is contained in:
Derek Macias 2015-12-21 00:06:42 -07:00
parent e27fbb5bad
commit 4b85f9c9fd
2 changed files with 27 additions and 27 deletions

View File

@ -1,35 +1,38 @@
#!/bin/sh #!/bin/sh
# read our configuration # read our configuration
source /boot/config/plugins/ipmitool-plugin/ipmitool-plugin.cfg
prog="ipmievd" prog="ipmievd"
prog2="ipmitail" prog2="ipmitail"
IPMIEVD="/usr/sbin/$prog" IPMIEVD="/usr/sbin/$prog"
IPMITAIL="/usr/local/emhttp/plugins/ipmitool-plugin/scripts/$prog2" IPMITAIL="/usr/local/emhttp/plugins/ipmitool-plugin/scripts/$prog2"
LOCKFILE="/var/lock/$prog" LOCKFILE="/var/lock/$prog"
PIDFILE="/var/run/$prog.pid0" PIDFILE="/var/run/$prog.pid0"
CONFIG="/boot/config/plugins/ipmitool-plugin" CONFIG="/boot/config/plugins/ipmitool-plugin/ipmitool-plugin.cfg"
OPTIONS="" OPTIONS=""
# no-op if already running if [ -e $CONFIG ]; then
if [ ! -r $PIDFILE ]; then source $CONFIG
if [ $REMOTE == "enable" ]; then if [ $SERVICE == "enable" ]; then
OPTIONS="-I lanplus -H $IPADDR -U $USER -P $(echo $PASSWORD | base64 --decode)" # no-op if already running
fi if [ ! -r $PIDFILE ]; then
sleep 1 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 & nohup $IPMIEVD sel $OPTIONS > /dev/null 2>&1 | logger -tipmitool &
touch $LOCKFILE touch $LOCKFILE
TIMER=0 TIMER=0
while [ ! -e $PIDFILE ]; do while [ ! -e $PIDFILE ]; do
sleep 1 sleep 1
let TIMER=$TIMER+1 let TIMER=$TIMER+1
if [ $TIMER -gt 5 ]; then if [ $TIMER -gt 5 ]; then
echo -n "$PIDFILE not created" echo -n "$PIDFILE not created"
break break
fi fi
done done
if [ -r $PIDFILE ]; then if [ -r $PIDFILE ]; then
nohup $IPMITAIL >/dev/null 2>&1 < /dev/null & nohup $IPMITAIL >/dev/null 2>&1 < /dev/null &
fi fi
fi
fi
fi fi

View File

@ -1,7 +1,4 @@
#!/bin/sh #!/bin/sh
# read our configuration
source /boot/config/plugins/ipmitool-plugin/ipmitool-plugin.cfg
prog="ipmievd" prog="ipmievd"
prog2="ipmitail" prog2="ipmitail"
LOCKFILE="/var/lock/$prog" LOCKFILE="/var/lock/$prog"