diff --git a/dolce_vita_collector_with_notifications.sh b/dolce_vita_collector_with_notifications.sh index b76be64..b17f44f 100755 --- a/dolce_vita_collector_with_notifications.sh +++ b/dolce_vita_collector_with_notifications.sh @@ -15,10 +15,12 @@ send_telegram_message() { curl -s -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" -d chat_id="$TELEGRAM_CHAT_ID" -d text="$message" } -# Function to log messages +# Function to log messages and send to Telegram log_message() { - echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE" - send_telegram_message "$1" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local message="[$timestamp] $1" + echo "$message" | tee -a "$LOG_FILE" + send_telegram_message "$message" } # Check for command line arguments @@ -63,10 +65,19 @@ else fi # Run make mint for each network without checking for success -for network in "${NETWORKS[@]}"; do - log_message "Running make mint for $network" +TOTAL_NETWORKS=${#NETWORKS[@]} +for ((i=0; i<$TOTAL_NETWORKS; i++)); do + network=${NETWORKS[$i]} + log_message "($((i+1))/$TOTAL_NETWORKS) Starting make mint for $network" timeout 180 make mint NETWORK=$network - log_message "Completed make mint for $network" + mint_result=$? + if [ $mint_result -eq 0 ]; then + log_message "($((i+1))/$TOTAL_NETWORKS) ✅ Completed make mint for $network successfully" + elif [ $mint_result -eq 124 ]; then + log_message "($((i+1))/$TOTAL_NETWORKS) ⏱️ make mint for $network timed out after 180 seconds" + else + log_message "($((i+1))/$TOTAL_NETWORKS) ❌ make mint for $network failed with exit code $mint_result" + fi done log_message "🏁 Dolce Vita Collector script completed" \ No newline at end of file