mirror of
https://github.com/wekan/wekan.git
synced 2025-12-20 09:20:12 +01:00
Updated Backup (markdown)
parent
1a7215b620
commit
fad047e58f
1 changed files with 17 additions and 15 deletions
32
Backup.md
32
Backup.md
|
|
@ -10,27 +10,27 @@ makeDump()
|
||||||
|
|
||||||
# Prepares.
|
# Prepares.
|
||||||
now=$(date +'%Y-%m-%d_%H.%M.%S')
|
now=$(date +'%Y-%m-%d_%H.%M.%S')
|
||||||
mkdir -p /var/backups/wekan/$now
|
mkdir -p /var/backups/wekan/$version-$now
|
||||||
|
|
||||||
# Targets the dump file.
|
# Targets the dump file.
|
||||||
dump=$"/snap/wekan/$version/bin/mongodump"
|
dump=$"/snap/wekan/$version/bin/mongodump"
|
||||||
|
|
||||||
# Makes the backup.
|
# Makes the backup.
|
||||||
cd /var/backups/wekan/$now
|
cd /var/backups/wekan/$version-$now
|
||||||
printf "\nThe backup of the database is starting.\n\n"
|
printf "\nThe database backup is in progress.\n\n"
|
||||||
$dump --port 27019
|
$dump --port 27019
|
||||||
|
|
||||||
# Makes the zip file.
|
# Makes the tar.gz file.
|
||||||
cd ..
|
cd ..
|
||||||
printf "\nMakes the zip.\n"
|
printf "\nMakes the tar.gz file.\n"
|
||||||
gzip -r $now.zip $version-$now
|
tar -zcvf $version-$now.tar.gz $version-$now
|
||||||
|
|
||||||
# Cleanups
|
# Cleanups
|
||||||
rm -rf $now
|
rm -rf $version-$now
|
||||||
|
|
||||||
# End.
|
# End.
|
||||||
printf "\nBackup done.\n"
|
printf "\nBackup done.\n"
|
||||||
echo "Backup is archived to .zip file at /var/backups/wekan/${now}.zip"
|
echo "Backup is archived to .tar.gz file at /var/backups/wekan/${version}-${now}.tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checks is the user is sudo/root
|
# Checks is the user is sudo/root
|
||||||
|
|
@ -55,9 +55,9 @@ makesRestore()
|
||||||
{
|
{
|
||||||
# Prepares the folder used for the backup.
|
# Prepares the folder used for the backup.
|
||||||
file=$1
|
file=$1
|
||||||
if [[ "$file" != *zip* ]]
|
if [[ "$file" != *tar.gz* ]]
|
||||||
then
|
then
|
||||||
echo "The backup archive must be a zip."
|
echo "The backup archive must be a tar.gz."
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -66,14 +66,15 @@ makesRestore()
|
||||||
parentDir=$"${file:0:${#file}-${#ext}}"
|
parentDir=$"${file:0:${#file}-${#ext}}"
|
||||||
cd $parentDir
|
cd $parentDir
|
||||||
|
|
||||||
# Unzip the archive.
|
# Untar the archive.
|
||||||
gunzip $file
|
printf "\nMakes the untar of the archive.\n"
|
||||||
file="${file:0:${#file}-4}"
|
tar -zxvf $file
|
||||||
|
file="${file:0:${#file}-7}"
|
||||||
|
|
||||||
# Gets the version of the snap.
|
# Gets the version of the snap.
|
||||||
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
|
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
|
||||||
|
|
||||||
# Targets the restore file.
|
# Targets the dump file.
|
||||||
restore=$"/snap/wekan/$version/bin/mongorestore"
|
restore=$"/snap/wekan/$version/bin/mongorestore"
|
||||||
|
|
||||||
# Restores.
|
# Restores.
|
||||||
|
|
@ -93,8 +94,9 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Starts.
|
# Start.
|
||||||
makesRestore $1
|
makesRestore $1
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker Backup and Restore
|
## Docker Backup and Restore
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue