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
Branches
No related tags found
No related merge requests found
......@@ -23,16 +23,33 @@ start() {
echo "starting" > $LOCK_FILE
stdbuf -oL opcua-generic-chimeratk-server01 &>> $LOG_FILE &
# Wait for server started
(tail -F -n0 $LOG_FILE & ) | grep -q "All application modules are running"
(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" && (echo "started" > $LOCK_FILE) &
# Restart FPGA application because server writes all zeros
echo "Restart FPGA application" >> $LOG_FILE
/etc/init.d/fofb-init.sh start
# Wait for server started or crashed
while :
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