Update backupcpv2.sh
Revision of the script for the current CloudPanel v2. It is now necessary to enter a specific database to be backed up.
This commit is contained in:
parent
f8a15c6055
commit
bdba80ace1
1 changed files with 14 additions and 11 deletions
|
@ -11,7 +11,7 @@ NUM_CORES=$(nproc || echo 1)
|
||||||
# You need to adjust the settings in the #
|
# You need to adjust the settings in the #
|
||||||
# TODO section for yourself #
|
# TODO section for yourself #
|
||||||
# Author : Mark Schenk <info@foxly.de> #
|
# Author : Mark Schenk <info@foxly.de> #
|
||||||
# Date : 2022-05-21 14:08 #
|
# Date : 2024-04-27 14:08 #
|
||||||
# License : MIT #
|
# License : MIT #
|
||||||
# Version : 2.0.0 #
|
# Version : 2.0.0 #
|
||||||
# #
|
# #
|
||||||
|
@ -21,8 +21,8 @@ NUM_CORES=$(nproc || echo 1)
|
||||||
# TODO / Variables #
|
# TODO / Variables #
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
# Which PHP version do you use e.g. 7.3 , 7.4 , 8.0
|
# Which PHP version do you use e.g. 8.2, 8.3
|
||||||
phpversion="8.1"
|
phpversion="8.2"
|
||||||
|
|
||||||
# Just adjust the domain here e.g. cloud.example.org or example.org
|
# Just adjust the domain here e.g. cloud.example.org or example.org
|
||||||
domain="cloud.example.tld"
|
domain="cloud.example.tld"
|
||||||
|
@ -31,7 +31,8 @@ domain="cloud.example.tld"
|
||||||
backupPassword="P@ssw0rd"
|
backupPassword="P@ssw0rd"
|
||||||
|
|
||||||
# Here you have to specify the path to the Borg repository.
|
# Here you have to specify the path to the Borg repository.
|
||||||
backupRepo="/mnt/"
|
backupRepo="/mnt/backup"
|
||||||
|
backupDatabase="/mnt/backup/database"
|
||||||
|
|
||||||
# You must edit this user to Site User from the Domain.
|
# You must edit this user to Site User from the Domain.
|
||||||
siteUser="User"
|
siteUser="User"
|
||||||
|
@ -129,11 +130,16 @@ sudo -u $siteUser php$phpversion $ncLocation$domain/occ maintenance:mode --on
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# DATABASES: Remove "#" for the correct database
|
# DATABASES: Remove "#" for the correct database
|
||||||
# You can backup only all databases in CPv2 specific databases.
|
# You have to enter a specific database. It is no longer possible to save all databases at the same time.
|
||||||
|
|
||||||
echo -e "\e[93mStart MariaDB/MySQL database backup"
|
####################
|
||||||
|
# MySQL Backup #
|
||||||
|
####################
|
||||||
|
|
||||||
|
echo -e "\e[93mStart MySQL database backup"
|
||||||
|
|
||||||
|
bash clpctl db:export --databaseName=DATABASENAME --file=$backupDatabase/backup_$(date +%d-%m-%Y).sql.gz
|
||||||
|
|
||||||
su -s /bin/bash -c '/usr/bin/clpctl db:backup --retentionPeriod=7' clp
|
|
||||||
|
|
||||||
echo -e "${FGREEN}Backup has been finished successfully after $(displaytime $(($(date +%s) - START)))!${FEND}"
|
echo -e "${FGREEN}Backup has been finished successfully after $(displaytime $(($(date +%s) - START)))!${FEND}"
|
||||||
|
|
||||||
|
@ -144,9 +150,6 @@ echo -e "${FGREEN}Backup has been finished successfully after $(displaytime $(($
|
||||||
# Script #
|
# Script #
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export BORG_REPO=$backupRepo
|
export BORG_REPO=$backupRepo
|
||||||
export BORG_PASSPHRASE=$backupPassword
|
export BORG_PASSPHRASE=$backupPassword
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue