From 15c5ea75e5f0ab1729fd02b03c0260a0457f8256 Mon Sep 17 00:00:00 2001 From: crowetic Date: Sat, 19 Oct 2024 22:24:56 -0700 Subject: [PATCH] added restart-qortal-every-2-hours.sh --- restart-qortal-every-2-hours.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 restart-qortal-every-2-hours.sh diff --git a/restart-qortal-every-2-hours.sh b/restart-qortal-every-2-hours.sh new file mode 100644 index 0000000..4caca82 --- /dev/null +++ b/restart-qortal-every-2-hours.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Path to the Qortal folder +QORTAL_DIR=~/qortal + +while true; do + # Navigate to Qortal directory + cd "$QORTAL_DIR" || exit + + # Stop Qortal core + ./stop.sh + + # Wait for 45 seconds + sleep 45 + + # Kill all Java processes + killall -9 java + + # Remove blockchain lock file + rm -rf "$QORTAL_DIR/db/blockchain.lck" + + # Start Qortal core + ./start.sh + + # Wait for 2 hours before restarting again, while tailing the log file + sleep 2h & + tail -f "$QORTAL_DIR/qortal.log" + + # Kill the tail process after sleep is done + kill $! +done +