Skip to content

Instantly share code, notes, and snippets.

@brahimmachkouri
brahimmachkouri / install_portainer.sh
Last active May 30, 2025 19:07
Ubuntu : install Portainer
#!/usr/bin/env bash
set -euo pipefail
cleanup() { [[ -n "${SUDO_LOOP_PID:-}" ]] && kill "$SUDO_LOOP_PID"; }
trap cleanup EXIT
command -v sudo >/dev/null || { echo "❌ sudo manquant"; exit 1; }
sudo -v
( while true; do sudo -n true; sleep 60; done ) & SUDO_LOOP_PID=$!