diff --git a/bin/cron.sh b/bin/cron.sh index e1f8ca4b2ab16b5f263554635cc3dbfd8cfebdac..50a0b0ad669253b9e806284b01d57aa52916ad94 100755 --- a/bin/cron.sh +++ b/bin/cron.sh @@ -8,13 +8,4 @@ exec < /dev/null > bfa-cron-output.log 2>&1 # Go to script bin, 'cause we expect to find $BFAHOME/bin/env there cd `dirname $0` source ./env -( - ./start.sh & - # Yes, we wait 60 seconds after starting the server. - # If you don't want to wait, kill the sleep.. the || true - # will capture the ERR trap. - while sleep 60 || true - do - ./monitor.sh - done & -) +./start.sh diff --git a/bin/installbfa.sh b/bin/installbfa.sh index 8f7c884c9f16a6569861f0593f63342983e3289d..d21f5dec26c97e612f09eff4b0f98a6343f05ca0 100755 --- a/bin/installbfa.sh +++ b/bin/installbfa.sh @@ -163,6 +163,7 @@ function usersetup info Adding to automatically source \~bfa/bfa/bin/env via .bashrc echo 'source ~/bfa/bin/env' >> .bashrc fi + mkdir ~bfa/bfa/network } function cronit diff --git a/bin/start.sh b/bin/start.sh index 734b39a00e3a175702fde8ec289008f3aaf41983..11dbad6c9f35e2d54d3139c8605f1a94c1d57846 100755 --- a/bin/start.sh +++ b/bin/start.sh @@ -80,6 +80,25 @@ function startbootnode ) 9>> $pidfile } +function startmonitor +{ + local pidfile=${BFANETWORKDIR}/monitor.pid + ( + flock --nonblock --exclusive 9 || ( + echo "A monitor is already running." + false + ) || exit + sleep 15 + while : + do + monitor.sh & + echo $! > $pidfile + wait + sleep 60 + done & + ) 9>> $pidfile +} + function startgeth { # Start the node. @@ -121,3 +140,4 @@ function startgeth startgeth startbootnode +startmonitor