Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts_and_config
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Siick
scripts_and_config
Commits
a92df2b3
Commit
a92df2b3
authored
5 years ago
by
siick
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parents
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
custom.conf
+43
-0
43 additions, 0 deletions
custom.conf
mysqlbackup.sh
+39
-0
39 additions, 0 deletions
mysqlbackup.sh
sitesbackup.sh
+22
-0
22 additions, 0 deletions
sitesbackup.sh
with
104 additions
and
0 deletions
custom.conf
0 → 100644
+
43
−
0
View file @
a92df2b3
[
DEFAULT
]
ignoreip
=
127
.
0
.
0
.
1
192
.
168
.
1
.
43
#<---Votre IP pour ne pas vous bannir
findtime
=
600
bantime
=
86400
maxretry
=
3
[
sshd
]
enabled
=
true
port
=
32022
logpath
= /
var
/
log
/
auth
.
log
maxretry
=
3
[
sshd
-
ddos
]
enabled
=
true
[
apache
]
enabled
=
true
port
=
http
,
https
filter
=
apache
-
auth
logpath
= /
var
/
log
/
apache2
/
error
*.
log
maxretry
=
3
[
apache
-
noscript
]
enabled
=
true
port
=
http
,
https
filter
=
apache
-
noscript
logpath
= /
var
/
log
/
apache2
/
error
*.
log
maxretry
=
3
[
apache
-
overflows
]
enabled
=
true
port
=
http
,
https
filter
=
apache
-
overflows
logpath
= /
var
/
log
/
apache2
/
error
*.
log
maxretry
=
2
[
apache
-
badbots
]
enabled
=
true
port
=
http
,
https
filter
=
apache
-
badbots
logpath
= /
var
/
log
/
apache2
/
error
*.
log
maxretry
=
2
This diff is collapsed.
Click to expand it.
mysqlbackup.sh
0 → 100755
+
39
−
0
View file @
a92df2b3
#!/bin/bash
# Configuration de la date
DATE
=
$(
date
+
"%Y%m%d"
)
# Dossier où sauvegarder les backups (à créer d'abord!)
BACKUP_DIR
=
"chemin/vers/dossier/de/sauvegarde"
# Identifiants MySQL
MYSQL_USER
=
"user"
MYSQL_PASSWORD
=
"identifiant"
# Commandes MySQL
MYSQL
=
/usr/bin/mysql
MYSQLDUMP
=
/usr/bin/mysqldump
# Bases de données MySQL à ignorer
SKIPDATABASES
=
"Database|information_schema|performance_schema|mysql"
# Nombre de jours à garder les dossiers (seront effacés après X jours)
RETENTION
=
2
# ---- NE RIEN MODIFIER SOUS CETTE LIGNE ------------------------------------------
#
# Crée un nouveau répertoire dans le dossier de sauvegarde avec la date
mkdir
-p
$BACKUP_DIR
/
$DATE
# La liste des bases de données
databases
=
`
$MYSQL
-u
$MYSQL_USER
-p
$MYSQL_PASSWORD
-e
"SHOW DATABASES;"
|
grep
-Ev
"(
$SKIPDATABASES
)"
`
# Sauvegarde les bases de données et gzip sur les fichiers .sql
for
db
in
$databases
;
do
echo
$db
$MYSQLDUMP
--force
--opt
--user
=
$MYSQL_USER
-p
$MYSQL_PASSWORD
--skip-lock-tables
--events
--databases
$db
|
gzip
>
"
$BACKUP_DIR
/
$DATE
/
$db
.sql.gz"
done
# Supprime les fichiers vieux de X jours
find
$BACKUP_DIR
/
*
-mtime
+
$RETENTION
-delete
\ No newline at end of file
This diff is collapsed.
Click to expand it.
sitesbackup.sh
0 → 100644
+
22
−
0
View file @
a92df2b3
#!/bin/bash
# Configuration de la date
DATE
=
$(
date
+
"%Y%m%d"
)
# Dossier où sauvegarder les backups (à créer d'abord!)
BACKUP_DIR
=
"chemin/vers/dossier/de/sauvegarde"
# Nombre de jours à garder les dossiers (seront effacés après X jours)
RETENTION
=
2
# ---- NE RIEN MODIFIER SOUS CETTE LIGNE ------------------------------------------
#
# Crée un nouveau répertoire dans le dossier de sauvegarde avec la date
mkdir
-p
$BACKUP_DIR
/
$DATE
# copie tous les sites
cp
-r
/var/www/html/
$BACKUP_DIR
/
$DATE
/
# Supprime les fichiers vieux de X jours
find
$BACKUP_DIR
/
*
-mtime
+
$RETENTION
-delete
\ No newline at end of file
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