From f82e55f6066d9bae602d0e3907c3e2e26a57e5ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert=20Martin-Leg=C3=A8ne?= <robert@nic.ar>
Date: Fri, 3 Aug 2018 15:58:36 -0300
Subject: [PATCH] Fixed documentation to call the correct script from crontab
 on reboot. Also changed cron.sh a bit.

---
 README.md   |  2 +-
 bin/cron.sh | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 619c777..309c191 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
 4. `source ${HOME}/bfa/bin`
    - You can include this line in your .bash_profile if you want.
    - It is perfectly safe to source it multiple times.
-5. Install this crontab: `@reboot bfa/network5445/start.sh`
+5. Install this crontab: `@reboot bfa/bin/cron.sh`
    - If you are running a sealer you MUST do this.
 6. run `start.sh`. This will start synchronizing and probably takes at least an hour.
 7. Change your node's settings with `syncmode.sh`
diff --git a/bin/cron.sh b/bin/cron.sh
index c8070ea..e1f8ca4 100755
--- a/bin/cron.sh
+++ b/bin/cron.sh
@@ -1,13 +1,20 @@
 #!/bin/bash
 
 trap 'exit 1' ERR
+# Go $HOME
+cd
+# Log in home directory
+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
-exec < /dev/null > /dev/null 2> /dev/null
 (
     ./start.sh &
-    while ./monitor.sh || true
+    # 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
-        sleep 60
+        ./monitor.sh
     done &
 )
-- 
GitLab