Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compose.libre.sh
Manage
Activity
Members
Labels
Plan
Issues
18
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libre.sh
compose.libre.sh
Merge requests
!186
WIP: Resolve "Restore from legacy backup"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
WIP: Resolve "Restore from legacy backup"
182-restore-from-legacy-backup
into
master
Overview
0
Commits
27
Pipelines
0
Changes
2
Open
Michel Memeteau
requested to merge
182-restore-from-legacy-backup
into
master
5 years ago
Overview
0
Commits
27
Pipelines
0
Changes
2
Expand
Closes
#182
👍
0
👎
0
Merge request reports
Viewing commit
3f9e425b
Prev
Next
Show latest version
2 files
+
105
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
3f9e425b
First version from bmauclaire work
· 3f9e425b
Michel Memeteau
authored
5 years ago
utils/backup_piwigo.sh
0 → 100644
+
45
−
0
Options
#!/bin/bash
#- Backup App (Piwigo) database and data files
#- Author: B. Mauclaire - bm@ekimia.fr - 2019/11/11
#- Usage: vm archive's name will be built with the database's name
#--- Manage arguments:
case
$#
in
1
)
ARG1
=
"
$1
"
;;
*
)
echo
"Usage: ./backup_piwigo.sh DB_PASSWORD"
;;
esac
#--- Connexion parameters:
HOST_NAME
=
'jaguar.ekimia.fr'
HOST_USER
=
'root'
HOST_PORT
=
622
DB_NAME
=
'piwigo'
DB_USER
=
'piwigo'
DB_PWD
=
"
$ARG1
"
APP_DIR
=
'/var/www/photos'
APP_DATA1
=
'i'
;
# photos/_data/i
APP_DATA2
=
'upload'
;
# photos/upload
#--- Beginning backup:
echo
"***** Backup
$DB_NAME
application data *****"
echo
""
#--- Backup database:
echo
"*** Database backup from
$HOST_NAME
to local file
${
DB_NAME
}
.sql ***"
ssh
-p
$HOST_PORT
${
HOST_USER
}
@
$HOST_NAME
"mysqldump '"
$DB_NAME
"' -u '"
$DB_USER
"' -p'"
${
DB_PWD
}
"'"
>
${
DB_NAME
}
.sql
echo
"Database dump uploaded!"
#--- Backup data:
echo
"*** App data backup from
$HOST_NAME
to local file
${
DB_NAME
}
.tgz ***"
echo
"Build archive on
$HOST_NAME
..."
ssh
-p
$HOST_PORT
${
HOST_USER
}
@
$HOST_NAME
"cd
${
APP_DIR
}
/_data ; tar czf /
${
HOST_USER
}
/
${
DB_NAME
}
_
${
APP_DATA1
}
mages.tgz
$APP_DATA1
"
ssh
-p
$HOST_PORT
${
HOST_USER
}
@
$HOST_NAME
"cd
${
APP_DIR
}
; tar czf /
${
HOST_USER
}
/
${
DB_NAME
}
_
${
APP_DATA2
}
.tgz
$APP_DATA2
"
echo
"Archive built!"
echo
"Start downloading archive (be patient)..."
scp
-P
$HOST_PORT
${
HOST_USER
}
@
$HOST_NAME
:/
${
HOST_USER
}
/
${
DB_NAME
}*
.tgz
.
echo
"Archive
${
DB_NAME
}
*.tgz downloaded!"
ssh
-p
$HOST_PORT
${
HOST_USER
}
@
$HOST_NAME
"rm -f
${
DB_NAME
}
*.tgz"
#--- End of tasks:
echo
""
echo
"***** End of
$DB_NAME
backup *****"
Loading