Skip to content
Snippets Groups Projects
Verified Commit 9c192559 authored by David Beniamine's avatar David Beniamine
Browse files

Update files after test

parent c51c772b
No related branches found
No related tags found
No related merge requests found
......@@ -31,40 +31,40 @@ HTTP_STATUS=$(curl -o /dev/null -w "%{http_code}\n" -s -k $URL)
do_sendmail_start() {
cat <<EOF | sendmail -t root
cat <<EOF | /usr/sbin/sendmail -t root
Subject: [$(hostname)] Serveur Tetrix injoignable
Bonjour,
$(hostname) viens de detecter que Tetrix est injoignable par son IP normale ($tetrixPublicIPOnOVH).
Le système d'accès à distance à Tétrix via $(hostname) (reverseSSHproxyPath) est actif,
dès que le réseau passera en mode de secours (4G), ce dernier sera joignable à nouveau.
Le systeme d'accès a distance à Tetrix via $(hostname) (reverseSSHproxyPath) est actif,
des que le reseau passera en mode de secours (4G), ce dernier sera joignable a nouveau.
Cordialement,
EOF
}
do_sendmail_stop() {
cat <<EOF | sendmail -t root
Subject: [$(hostname)] Serveur Tetrix injoignable
cat <<EOF | /usr/sbin/sendmail -t root
Subject: [$(hostname)] Serveur Tetrix a nouveau joignable
Bonjour,
$(hostname) viens de detecter que Tetrix est à nouveau joignable par son IP nornale ($tetrixPublicIPOnOVH).
Le système d'accès à distance à Tétrix via $(hostname) (reverseSSHproxyPath) est désactivé,
dès que le réseau repassera en mode de normal (Fibre), ce dernier sera joignable à nouveau.
$(hostname) viens de detecter que Tetrix est a nouveau joignable par son IP nornale ($tetrixPublicIPOnOVH).
Le systeme d'accès a distance à Tetrix via $(hostname) (reverseSSHproxyPath) est désactivé,
des que le reseau repassera en mode de normal (Fibre), ce dernier sera joignable a nouveau.
Cordialement,
EOF
}
if [[ -f "$stateFile" ]]; then
if [ -f "$stateFile" ]; then
$state=`cat $stateFile`
state=`cat $stateFile`
# check if tetrix is reachable (status code 200)
if [ $HTTP_STATUS -eq 200 ]; then
if [[ $state != "normal" ]]; then
if [ $state != "normal" ]; then
# Switch on normal mode
cd $reverseSSHproxyPath
docker-compose down
......@@ -72,7 +72,7 @@ if [[ -f "$stateFile" ]]; then
do_sendmail_start root
fi
else
if [[ $state == "normal" ]]; then
if [ $state == "normal" ]; then
# Switch on back up mode
cd $reverseSSHproxyPath
docker-compose up -d
......
......@@ -45,18 +45,18 @@ change_dns() {
curl -s -X PUT --header "Authorization: Bearer ${APIKEY}" \
--header "Content-Type: application/json" \
-d "{\"rrset_values\": [\"${CURRENTIP}\"], \"rrset_ttl\": "300"}" \
https://api.gandi.net/v5/livedns/domains/tetras-libre.fr/records/tetrixx/A
https://api.gandi.net/v5/livedns/domains/tetras-libre.fr/records/tetrix/A
}
do_sendmail_start() {
cat <<EOF | sendmail -t $recipient
Subject: [$(hostname)] Bascule du réseau en $1
cat <<EOF | /usr/sbin/sendmail -t $recipient
Subject: [$(hostname)] Bascule du reseau en mode secours (4G)
Bonjour,
La bascule automatique du réseau viens de s'activer sur $(hostname). Passage en $1.
La bascule automatique du reseau viens de s'activer sur $(hostname). Passage en mode secours (4G).
Pour utiliser gitlab, vous devez ajouter ces lignes dans ~/.ssh/config :
......@@ -64,7 +64,7 @@ host gitlab.tetras-libre.fr
Port 2223
La bascule se fait via un changement de DNS qui peut mettre un peu de temps à ce propager (3h) max.
La bascule se fait via un changement de DNS qui peut mettre un peu de temps a ce propager (3h) max.
Pendant ce temps vous pouvez ajouter les lignes suivantes dans /etc/hosts:
$aquilaPublicIPOnOVH nextcloud.tetras-libre.fr
......@@ -72,7 +72,7 @@ $aquilaPublicIPOnOVH gitlab.tetras-libre.fr
$aquilaPublicIPOnOVH dolibarr.tetras-libre.fr
$aquilaPublicIPOnOVH passbolt.tetras-libre.fr
En cas de problème, contactez $adminemail
En cas de probleme, contactez $adminemail
Cordialement,
EOF
......@@ -80,17 +80,17 @@ EOF
do_sendmail_stop() {
cat <<EOF | sendmail -t $recipient
Subject: [$(hostname)] Bascule du réseau en $1
cat <<EOF | /usr/sbin/sendmail -t $recipient
Subject: [$(hostname)] Bascule du reseau en mode normal (Fibre)
Bonjour,
La bascule automatique du réseau viens de s'activer sur $(hostname). Passage en $1.
La bascule automatique du reseau viens de s'activer sur $(hostname). Passage en mode normal (Fibre).
Pour utiliser gitlab, pensez à supprimer les lignes concernant gitlab.tetras-libre.fr dans ~/.ssh/config.
Pour utiliser gitlab, pensez a supprimer les lignes concernant gitlab.tetras-libre.fr dans ~/.ssh/config.
La bascule se fait via un changement de DNS qui peut mettre un peu de temps à ce propager (3h) max.
La bascule se fait via un changement de DNS qui peut mettre un peu de temps a ce propager (3h) max.
Pendant ce temps vous pouvez ajouter les lignes suivantes dans /etc/hosts:
$tetrixPublicIPOnOVH nextcloud.tetras-libre.fr
......@@ -98,20 +98,18 @@ $tetrixPublicIPOnOVH gitlab.tetras-libre.fr
$tetrixPublicIPOnOVH dolibarr.tetras-libre.fr
$tetrixPublicIPOnOVH passbolt.tetras-libre.fr
En cas de problème, contactez $adminemail
En cas de probleme, contactez $adminemail
EOF
}
# check if file exist
if [[ -f "$stateFile" ]]; then
if [ -f "$stateFile" ]; then
$state=`cat $stateFile`
state=`cat $stateFile`
# Check if current ip is different of normal ip
if [[ $tetrixPublicIPOnOVH == $currentIP ]]; then
if [[ $state != "normal" ]]; then
if [ $tetrixPublicIPOnOVH == $currentIP ]; then
if [ $state != "normal" ]; then
# Switch on normal mode
pid=`ps aux | grep test.sh | grep -v grep | awk '{print $2}'`
kill $pid
......@@ -120,7 +118,7 @@ if [[ -f "$stateFile" ]]; then
do_sendmail_start
fi
else
if [[ $state == "normal" ]]; then
if [ $state == "normal" ]; then
# Switch on back up mode
bash $reverseSSHProxyPath &
change_dns $APIKEY $aquilaPublicIPOnOVH
......
#!/bin/bash
HTTPS_PORT=8080
HTTPS_PORT=8443
SSHPORT_INT=2223
SSHPORT=2222
PROXY_HOST=aquila.tetras-libre.fr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment