poa-network-monitor/scripts/test-runner.sh

38 lines
501 B
Bash
Executable File

#!/bin/bash
echo "$1"
cd "${BASH_SOURCE%/*}"
PIDFILE=./pids/$1
if [ -f $PIDFILE ]
then
PID=$(cat $PIDFILE)
ps -p $PID > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Process is running"
exit 1
else
## Process is not running
echo $$ > $PIDFILE
if [ $? -ne 0 ]
then
echo "Could not create PID file"
exit 1
fi
fi
else
echo $$ > $PIDFILE
if [ $? -ne 0 ]
then
echo "Could not create PID file"
exit 1
fi
fi
# run test
./$1.sh
rm $PIDFILE