fixed issue where restart wasn't actually taking place, and added checks for stop.sh correctly finishing prior to killing as last resort after 30 seconds. May need to modify time a bit more.

This commit is contained in:
crowetic 2024-10-24 09:41:52 -07:00
parent d792c8e5e8
commit b988742727

View File

@ -8,27 +8,32 @@ while true; do
cd "$QORTAL_DIR" || exit cd "$QORTAL_DIR" || exit
# Stop Qortal core # Stop Qortal core
./stop.sh ./stop.sh &> stop_output.log
# Wait for 45 seconds # Wait for 30 seconds
sleep 30 sleep 30
if [ -f "$QORTAL_DIR/db/blockchain.lck" ]; then # Check if stop script succeeded
if ! grep -q "Qortal ended gracefully" stop_output.log; then
# Kill all Java processes # Stop script did not complete successfully, kill Java process
killall -9 java echo "Stop script did not complete successfully, force killing Java..."
killall -9 java
# Remove blockchain lock file # Remove blockchain lock file
rm -rf "$QORTAL_DIR/db/blockchain.lck" rm -rf "$QORTAL_DIR/db/blockchain.lck"
fi fi
# Start Qortal core # Start Qortal core
./start.sh ./start.sh
# Wait for 2 hours before restarting again, while tailing the log file # Wait for 2 hours while logging output
sleep 2h & sleep 2h &
tail -f "$QORTAL_DIR/qortal.log" sleep_pid=$!
tail -f "$QORTAL_DIR/qortal.log" &
tail_pid=$!
# Kill the tail process after sleep is done # Wait for the sleep to finish, then kill the tail process
kill $! wait $sleep_pid
kill $tail_pid
done done