Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Script Stability: Error Handling, NTP Sync, Wait Behavior, and Package Management #69

Closed
wants to merge 1 commit into from
Closed

Conversation

nmehran
Copy link

@nmehran nmehran commented Mar 8, 2024

Changes (closes #68):

  • End script immediately on error
  • Alternate method to force re-sync of NTP
  • Update and upgrade system packages, with lock mitigation support.
  • Synchronize node NTPs to ensure time synchronization on nodes
  • Add robust wait on "Install Metallb"

Changes (closes #68):
- End script immediately on error
- Alternate method to force re-sync of NTP
- Update and upgrade system packages, with lock mitigation support.
- Synchronize node NTPs to ensure time synchronization on nodes
- Add robust wait on "Install Metallb"
sudo timedatectl set-ntp on
sudo systemctl restart systemd-timesyncd

# Update and upgrade system packages, with lock mitigation support.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can further streamline this with:

# Update and upgrade system packages, with lock mitigation support
attempt_limit=10
attempt_delay_seconds=3
for ((attempt=1; attempt<=attempt_limit; attempt++)); do
    if sudo apt-get update && sudo apt-get upgrade -y; then
        echo "Package list updated and packages upgraded successfully."
        break # Success
    elif ((attempt == attempt_limit)); then
        echo "Failed to update and upgrade packages within $attempt_limit attempts."
        exit 1 # Failure after all attempts
    else
        echo "Attempt $attempt of $attempt_limit failed. Retrying in $attempt_delay_seconds seconds..."
        sleep $attempt_delay_seconds
    fi
done

@nmehran nmehran closed this by deleting the head repository Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

K3S-Deploy - Suggestions for enhancement
1 participant