Skip to content
Snippets Groups Projects
Commit 3e56feb3 authored by BRONES Romain's avatar BRONES Romain
Browse files

fix(opcua): Start deamon exit when server fails to start

parent a85f12dd
No related branches found
No related tags found
No related merge requests found
...@@ -23,16 +23,33 @@ start() { ...@@ -23,16 +23,33 @@ start() {
echo "starting" > $LOCK_FILE echo "starting" > $LOCK_FILE
stdbuf -oL opcua-generic-chimeratk-server01 &>> $LOG_FILE & stdbuf -oL opcua-generic-chimeratk-server01 &>> $LOG_FILE &
# Wait for server started (tail -F -n0 $LOG_FILE & ) | grep -q "ChimeraTK::logic_error" && (echo "crashed" > $LOCK_FILE) &
(tail -F -n0 $LOG_FILE & ) | grep -q "All application modules are running" (tail -F -n0 $LOG_FILE & ) | grep -q "All application modules are running" && (echo "started" > $LOCK_FILE) &
# Restart FPGA application because server writes all zeros # Wait for server started or crashed
echo "Restart FPGA application" >> $LOG_FILE while :
/etc/init.d/fofb-init.sh start do
state=$(cat $LOCK_FILE)
if [ "$state" = "started" ] ; then
# Reset the FPGA
echo "Init again application" >> $LOG_FILE
/etc/init.d/fofb-init.sh start >> $LOG_FILE
success
break
fi
if [ "$state" = "crashed" ] ; then
failure
break
fi
sleep 1
done
kill $(jobs -p)
### Create the lock file ###
echo "started" > $LOCK_FILE
success $"fofb-opcua server startup"
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment