Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,41 @@ edit_ips() {
}

hysteria_upgrade(){
bash <(curl https://raw.githubusercontent.com/ReturnFI/Blitz/main/upgrade.sh)
# Check if upgrade is already running
if [ -f "/tmp/hysteria_upgrade.lock" ]; then
echo -e "${red}Error:${NC} An upgrade process is already running or was interrupted."
echo -e "${yellow}Please check the system status and remove /tmp/hysteria_upgrade.lock if needed.${NC}"
return 1
fi

# Create lock file to prevent concurrent upgrades
echo $$ > /tmp/hysteria_upgrade.lock
echo -e "${yellow}Upgrade process started. PID: $$${NC}"

# Use nohup to continue running even if SSH disconnects
# Redirect output to log file for later inspection
nohup bash <(curl -s https://raw.githubusercontent.com/ReturnFI/Blitz/main/upgrade.sh) > /var/log/hysteria_upgrade.log 2>&1 &

UPGRADE_PID=$!
echo -e "${green}Upgrade process started in background (PID: $UPGRADE_PID).${NC}"
echo -e "${yellow}You can safely disconnect. The upgrade will continue in the background.${NC}"
echo -e "${yellow}Check progress with: tail -f /var/log/hysteria_upgrade.log${NC}"
echo -e "${yellow}Or check status with: ps aux | grep upgrade.sh${NC}"

# Wait a moment to let the process start
sleep 2

# Check if the process is still running
if ps -p $UPGRADE_PID > /dev/null; then
echo -e "${green}Upgrade process is running successfully in the background.${NC}"
else
echo -e "${red}Error:${NC} Upgrade process failed to start."
rm -f /tmp/hysteria_upgrade.lock
return 1
fi

# Remove lock file when done (this will be handled by the upgrade script)
# The upgrade script should remove the lock file when completed
}

warp_configure_handler() {
Expand Down
19 changes: 18 additions & 1 deletion upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,17 @@ for SERVICE in "${ALL_SERVICES[@]}"; do
fi
done

# ========== Check for existing upgrade process ==========
if [ -f "/tmp/hysteria_upgrade.lock" ]; then
info "Found existing upgrade lock file. This might be from a previous interrupted upgrade."
info "Removing lock file to allow this upgrade to proceed..."
rm -f /tmp/hysteria_upgrade.lock
fi

# ========== Create new lock file ==========
echo $$ > /tmp/hysteria_upgrade.lock
info "Upgrade process started. PID: $$"

# ========== Check AVX Support Prerequisite ==========
check_avx_support

Expand Down Expand Up @@ -356,4 +367,10 @@ fi
info "Upgrade process finished. Launching menu..."
cd "$HYSTERIA_INSTALL_DIR"
chmod +x menu.sh
./menu.sh

# ========== Cleanup ==========
info "Cleaning up upgrade lock file..."
rm -f /tmp/hysteria_upgrade.lock
success "Upgrade lock file removed."

./menu.sh