#!/bin/bash # Colors - Blue to Teal/Cyan gradient palette BLUE='\033[0;34m' LBLUE='\033[1;34m' CYAN='\033[0;36m' LCYAN='\033[1;36m' GREEN='\033[0;32m' TEAL='\033[38;5;37m' DTEAL='\033[38;5;30m' YELLOW='\033[1;33m' RED='\033[0;31m' BOLD='\033[1m' DIM='\033[2m' NC='\033[0m' # No Color # Symbols CHECK="✔" CROSS="✖" ARROW="➜" GEAR="⚙" ROCKET="🚀" SPARKLE="✨" # Animation frames SPINNER_FRAMES=("⠋" "⠙" "⠹" "⠸" "⠼" "⠴" "⠦" "⠧" "⠇" "⠏") PROGRESS_CHARS=("░" "▒" "▓" "█") # Typewriter effect function typewriter() { local text="$1" local delay="${2:-0.03}" for ((i=0; i<${#text}; i++)); do echo -n "${text:$i:1}" sleep "$delay" done } # Spinner function - runs command with animated spinner spinner() { local pid=$1 local message="$2" local i=0 while kill -0 "$pid" 2>/dev/null; do echo -ne "\r ${LBLUE}${SPINNER_FRAMES[$i]}${NC} ${message}" i=$(( (i + 1) % ${#SPINNER_FRAMES[@]} )) sleep 0.1 done wait "$pid" return $? } # Progress bar function progress_bar() { local duration=$1 local width=30 local step=$(echo "scale=4; $duration / $width" | bc) echo -ne " ${LBLUE}[${NC}" for ((i=0; i0; i--)); do echo -ne "${LCYAN}${BOLD}${i}${NC} " for frame in "${SPINNER_FRAMES[@]}"; do echo -ne "${LBLUE}${frame}${NC}" sleep 0.1 echo -ne "\b" done done echo -e "${TEAL}${CHECK}${NC} ${SPARKLE}" echo "" # Git pull with spinner echo -e "${TEAL}${GEAR}${NC} ${BOLD}Pulling latest changes from Git...${NC}" git pull > /tmp/git_output.txt 2>&1 & GIT_PID=$! spinner $GIT_PID "Fetching from remote..." GIT_STATUS=$? if [ $GIT_STATUS -ne 0 ]; then echo -e "\r ${RED}${CROSS}${NC} Git pull failed! " cat /tmp/git_output.txt echo "" pulse_message "Restarting script..." "${YELLOW}" echo "" sleep 2 exec "$0" "$@" fi echo -e "\r ${TEAL}${CHECK}${NC} Git pull completed ${SPARKLE} " cat /tmp/git_output.txt | head -3 | while read line; do echo -e " ${DIM}${line}${NC}" done echo "" # Cache clearing with progress echo -e "${TEAL}${GEAR}${NC} ${BOLD}Clearing caches...${NC}" echo -ne " ${LBLUE}${SPINNER_FRAMES[0]}${NC} View cache" php artisan view:clear > /dev/null 2>&1 & spinner $! "View cache" echo -e "\r ${TEAL}${CHECK}${NC} View cache cleared ${SPARKLE} " echo -ne " ${LBLUE}${SPINNER_FRAMES[0]}${NC} Application cache" php artisan cache:clear > /dev/null 2>&1 & spinner $! "Application cache" echo -e "\r ${TEAL}${CHECK}${NC} Application cache cleared ${SPARKLE} " echo "" # PHP-FPM restart with progress bar echo -e "${TEAL}${GEAR}${NC} ${BOLD}Restarting PHP-FPM...${NC}" systemctl restart php8.3-fpm & RESTART_PID=$! spinner $RESTART_PID "Restarting service..." echo -e "\r ${TEAL}${CHECK}${NC} PHP 8.3 FPM restarted ${SPARKLE} " echo "" # Animated completion box sleep 0.3 draw_box_top echo -e "${CYAN}║ ║${NC}" sleep 0.1 echo -ne "${CYAN}║ ${TEAL}${ROCKET} ${NC}" typewriter "${BOLD}UPDATE COMPLETE!${NC}" 0.05 echo -e "${CYAN} ║${NC}" sleep 0.1 echo -e "${CYAN}║ ║${NC}" echo -e "${CYAN}║ ${NC}Paymenter has been successfully updated and services restarted.${CYAN} ║${NC}" echo -e "${CYAN}║ ║${NC}" draw_box_bottom # Final sparkle animation echo "" echo -ne " " for i in {1..5}; do echo -ne "${LCYAN}${SPARKLE}${NC} " sleep 0.15 done echo "" echo ""