Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
server-utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NoCloud
server-utils
Commits
a42dbfc5
Commit
a42dbfc5
authored
11 months ago
by
Elian Loraux
Browse files
Options
Downloads
Patches
Plain Diff
Scipt de bascule réseau côté aquila
parent
f0cb3b4b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
auto-start-reverseSSHproxy.sh
+47
-0
47 additions, 0 deletions
auto-start-reverseSSHproxy.sh
net-switch.sh
+0
-2
0 additions, 2 deletions
net-switch.sh
with
47 additions
and
2 deletions
auto-start-reverseSSHproxy.sh
0 → 100644
+
47
−
0
View file @
a42dbfc5
#!/usr/bin/env bash
# Si tetrix joingnable
# Si etatCourant != Normal
# etatCourrant = Normal
# StopperServiceSurAquila
# Sinon
# Si etatCourant != Backup
# etatCourant = Backup
# DemarrerServiceSurAquila
IPPubliqueTetrixChezOVH
=
"109.190.180.230"
URL
=
"https://
$IPPubliqueTetrixChezOVH
"
stateFile
=
"/opt/net-state"
reverseSSHproxyPath
=
"/home/dockerweb/reverse-ssh-proxy"
# Faire une requête HTTP et vérifier le code de statut de la réponse
HTTP_STATUS
=
$(
curl
-o
/dev/null
-w
"%{http_code}
\n
"
-s
-k
$URL
)
if
[[
-f
"
$stateFile
"
]]
;
then
$state
=
`
cat
$stateFile
`
# Vérifier si le service est accessible (code de statut 200)
if
[
$HTTP_STATUS
-eq
200
]
;
then
if
[[
$state
!=
"normal"
]]
;
then
# Switch on normal mode
cd
$reverseSSHproxyPath
docker-compose down
echo
"normal"
>
"
$stateFile
"
fi
else
if
[[
$state
=
"normal"
]]
;
then
# Switch on back up mode
cd
$reverseSSHproxyPath
docker-compose up
-d
echo
"backup"
>
"
$stateFile
"
fi
fi
else
echo
"normal"
>
"
$stateFile
"
fi
This diff is collapsed.
Click to expand it.
net-switch.sh
+
0
−
2
View file @
a42dbfc5
...
@@ -20,7 +20,6 @@ if [[ -f "$stateFile" ]]; then
...
@@ -20,7 +20,6 @@ if [[ -f "$stateFile" ]]; then
if
[[
$IPPubliqueTetrixChezOVH
==
$currentIP
]]
;
then
if
[[
$IPPubliqueTetrixChezOVH
==
$currentIP
]]
;
then
if
[[
$state
!=
"normal"
]]
;
then
if
[[
$state
!=
"normal"
]]
;
then
# Switch on normal mode
# Switch on normal mode
# ssh dockerweb@aquila.tetras-libre.fr 'cd reverse-ssh-proxy && docker-compose down'
pid
=
`
ps aux |
grep
test.sh |
grep
-v
grep
|
awk
'{print $2}'
`
pid
=
`
ps aux |
grep
test.sh |
grep
-v
grep
|
awk
'{print $2}'
`
kill
$pid
kill
$pid
change_dns
$APIKEY
$IPPubliqueTetrixChezOVH
change_dns
$APIKEY
$IPPubliqueTetrixChezOVH
...
@@ -29,7 +28,6 @@ if [[ -f "$stateFile" ]]; then
...
@@ -29,7 +28,6 @@ if [[ -f "$stateFile" ]]; then
else
else
if
[[
$state
=
"normal"
]]
;
then
if
[[
$state
=
"normal"
]]
;
then
# Switch on back up mode
# Switch on back up mode
# ssh dockerweb@aquila.tetras-libre.fr 'cd reverse-ssh-proxy && docker-compose up'
bash
$reverseSSHProxyPath
&
bash
$reverseSSHProxyPath
&
change_dns
$APIKEY
$IPPubliqueAquilaChezOVH
change_dns
$APIKEY
$IPPubliqueAquilaChezOVH
echo
"backup"
>
"
$stateFile
"
echo
"backup"
>
"
$stateFile
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment