Run NuBot using a script that intercept nubot shutdowns (and act)

Issue #192 wontfix
Desrever Nu created an issue

Since the java is not able to intercept a kill -9 event, NuBot should be wrapped around a script that detects it (see [1]) and clear active orders and liquidityinfo .

The solution below is only valid for unix system, while we want to make it system independent :

#!/bin/bash

#Concatenate arguments 
args=""
for var in "$@"
do
    args+=$var
done
    echo "$args"
java -jar NuBot $args

wait
# It gets here when the app quits, even with forced kill -9 <pid>
echo "NuBot was shut down. Executing the termination script to make sure all orders are cleaned up and liquidity info reset"
# Execute the cleanup using the same arguments
#java -jar NuBot kill $args
  1. http://stackoverflow.com/questions/2541597/how-to-gracefully-handle-the-sigkill-signal-in-java

Comments (17)

  1. Desrever Nu reporter

    added two runnable classes in launch package aimed at cleaning up liquidity and orders

  2. Benjamin Cordes

    A complete daemonization is not trivial. Perhaps there are some out of the box solutions...

  3. Desrever Nu reporter

    Merged the feature/192-startStop-script with develop, resolve this issue and open a new one

  4. Log in to comment