allow manual run

This commit is contained in:
John
2021-11-13 12:16:50 +01:00
parent 87324603a2
commit 46c35dbde1
+21 -6
View File
@@ -218,11 +218,21 @@ r,,SoftwareVersion,,,,,"0000",,,HEX:4,,,
EOF EOF
echo "test,testpass,installer" > ./passwd echo "test,testpass,installer" > ./passwd
#ebusd: #ebusd:
#./src/ebusd/ebusd -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 -l "$PWD/ebusd.log" --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile=./passwd --mqttport=1883 if [[ "$1" == "manual" ]]; then
./src/ebusd/ebusd -f -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile=./passwd --mqttport=1883 >"$PWD/ebusd.log" 2>&1 & echo -e "\n\n\nSTART EBUSD NOW, enter the PID and press enter\n"
pid=$! read pid
sleep 3 elif [[ -n "$1" ]]; then
#pid=`head -n 1 "$PWD/ebusd.pid"` echo "waiting for ebusd to be started..."
while [[ -z "$pid" ]]; do
pid=$(ps -C ebusd -o pid=)
done
else
#./src/ebusd/ebusd -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 -l "$PWD/ebusd.log" --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile=./passwd --mqttport=1883
./src/ebusd/ebusd -f -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile=./passwd --mqttport=1883 >"$PWD/ebusd.log" 2>&1 &
pid=$!
sleep 3
#pid=`head -n 1 "$PWD/ebusd.pid"`
fi
if [ -z "$pid" ]; then if [ -z "$pid" ]; then
echo `date` "unable to start ebusd" echo `date` "unable to start ebusd"
kill $srvpid kill $srvpid
@@ -230,7 +240,9 @@ if [ -z "$pid" ]; then
exit 1 exit 1
fi fi
echo `date` "ebusd: $pid" echo `date` "ebusd: $pid"
kill -1 $pid if [[ -n "$1" ]]; then
kill -1 $pid
fi
#client: #client:
readarray lines <<EOF readarray lines <<EOF
raw bytes raw bytes
@@ -414,5 +426,8 @@ kill $pid
echo `date` "ebusd log:" echo `date` "ebusd log:"
cat "$PWD/ebusd.log" cat "$PWD/ebusd.log"
echo `date` "done." echo `date` "done."
if [[ -n "$1" ]]; then
kill $pid
fi
wait $srvpid wait $srvpid
exit $failed exit $failed