Deploy: Use /tmp for SSH ControlPath to avoid spaces issue
This commit is contained in:
parent
30816f2d2d
commit
87a7c682d7
11
deploy.sh
11
deploy.sh
@ -9,19 +9,20 @@ APP_DIR="/var/www/${DOMAIN}"
|
|||||||
GIT_REPO="https://git.4nkweb.com/4nk/story-research-zapwall.git"
|
GIT_REPO="https://git.4nkweb.com/4nk/story-research-zapwall.git"
|
||||||
|
|
||||||
# Configuration SSH pour connexion persistante (évite MaxStartups)
|
# Configuration SSH pour connexion persistante (évite MaxStartups)
|
||||||
# Créer le répertoire de contrôle si nécessaire
|
# Utiliser un chemin temporaire sans espaces pour ControlPath
|
||||||
mkdir -p "$HOME/.ssh/control"
|
SSH_CONTROL_DIR="/tmp/ssh_control_$$"
|
||||||
SSH_CONTROL_PATH="$HOME/.ssh/control/debian_92.243.27.35_22"
|
mkdir -p "${SSH_CONTROL_DIR}"
|
||||||
SSH_OPTS="-o ControlMaster=auto -o ControlPath=\"${SSH_CONTROL_PATH}\" -o ControlPersist=300"
|
SSH_CONTROL_PATH="${SSH_CONTROL_DIR}/debian_92.243.27.35_22"
|
||||||
|
|
||||||
# Fonction pour exécuter une commande SSH avec connexion persistante
|
# Fonction pour exécuter une commande SSH avec connexion persistante
|
||||||
ssh_exec() {
|
ssh_exec() {
|
||||||
ssh -o ControlMaster=auto -o ControlPath="${SSH_CONTROL_PATH}" -o ControlPersist=300 ${SERVER} "$@"
|
ssh -o ControlMaster=auto -o ControlPath="${SSH_CONTROL_PATH}" -o ControlPersist=300 ${SERVER} "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Nettoyer les connexions SSH persistantes à la fin
|
# Nettoyer les connexions SSH persistantes et le répertoire temporaire à la fin
|
||||||
cleanup_ssh() {
|
cleanup_ssh() {
|
||||||
ssh -O exit -o ControlPath="${SSH_CONTROL_PATH}" ${SERVER} 2>/dev/null || true
|
ssh -O exit -o ControlPath="${SSH_CONTROL_PATH}" ${SERVER} 2>/dev/null || true
|
||||||
|
rm -rf "${SSH_CONTROL_DIR}" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
trap cleanup_ssh EXIT
|
trap cleanup_ssh EXIT
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user