better log check
This commit is contained in:
parent
1620ebd2e9
commit
ca6346428e
2 changed files with 15 additions and 15 deletions
|
|
@ -17,31 +17,30 @@ get_log_info() {
|
||||||
|
|
||||||
log "Checking wallet status... This may take a moment."
|
log "Checking wallet status... This may take a moment."
|
||||||
|
|
||||||
# Wait for unlocker log file
|
TIMESTAMP_FILE="/tmp/pub_install_timestamp"
|
||||||
|
|
||||||
|
# Wait for a new unlocker log file to be created
|
||||||
while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do
|
while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do
|
||||||
latest_unlocker_log=$(ls -1t ${LOG_DIR}/components/unlocker_*.log 2>/dev/null | head -n 1)
|
# Find a log file that is newer than our installation timestamp
|
||||||
[ -n "$latest_unlocker_log" ] && break
|
latest_unlocker_log=$(find "${LOG_DIR}/components/" -name "unlocker_*.log" -newer "$TIMESTAMP_FILE" -print0 2>/dev/null | xargs -0 ls -1t 2>/dev/null | head -n 1)
|
||||||
|
if [ -n "$latest_unlocker_log" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
sleep $WAIT_INTERVAL
|
sleep $WAIT_INTERVAL
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$latest_unlocker_log" ]; then
|
if [ -z "$latest_unlocker_log" ]; then
|
||||||
log "Error: No unlocker log file found. Please check the service status."
|
log "Error: No new unlocker log file found after starting services. Please check the service status."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the initial file size instead of line count
|
# Now that we have the correct log file, wait for the wallet status message
|
||||||
initial_size=$(stat -c %s "$latest_unlocker_log")
|
START_TIME=$(date +%s)
|
||||||
|
|
||||||
# Wait for new wallet status in log file
|
|
||||||
while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do
|
while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do
|
||||||
current_size=$(stat -c %s "$latest_unlocker_log")
|
latest_entry=$(grep -E "unlocker >> (the wallet is already unlocked|created wallet with pub:|unlocked wallet with pub)" "$latest_unlocker_log" | tail -n 1)
|
||||||
if [ $current_size -gt $initial_size ]; then
|
|
||||||
latest_entry=$(tail -c +$((initial_size + 1)) "$latest_unlocker_log" | grep -E "unlocker >> (the wallet is already unlocked|created wallet with pub:|unlocked wallet with pub)" | tail -n 1)
|
|
||||||
if [ -n "$latest_entry" ]; then
|
if [ -n "$latest_entry" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
initial_size=$current_size
|
|
||||||
sleep $WAIT_INTERVAL
|
sleep $WAIT_INTERVAL
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ else
|
||||||
install_lightning_pub "$REPO_URL" || log_error "Failed to install Lightning.Pub" 1
|
install_lightning_pub "$REPO_URL" || log_error "Failed to install Lightning.Pub" 1
|
||||||
|
|
||||||
log "Starting services..."
|
log "Starting services..."
|
||||||
|
touch /tmp/pub_install_timestamp
|
||||||
start_services $lnd_status $pub_upgrade_status || log_error "Failed to start services" 1
|
start_services $lnd_status $pub_upgrade_status || log_error "Failed to start services" 1
|
||||||
get_log_info || log_error "Failed to get log info" 1
|
get_log_info || log_error "Failed to get log info" 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue