Compare commits

..

No commits in common. "fd4b075a26882baa72104839a277fe46c708d9e6" and "802923994a594233a9b8defdd0b19bf6b2ef2584" have entirely different histories.

5 changed files with 37 additions and 161 deletions

View File

@ -38,17 +38,6 @@ function @ (){
return $? return $?
} }
# XXX should @@ and @ be the same -- use eval???
function @@ (){
if [ -z $DRY_RUN ] ; then
! [ $QUIET ] \
&& echo -e "${ECHO_PREFIX}$@"
eval "$@"
else
echo -e $@
fi
return $?
}
#---------------------------------------------------------------------- #----------------------------------------------------------------------

View File

@ -1,61 +0,0 @@
#!/usr/bin/bash
#----------------------------------------------------------------------
cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)")
#----------------------------------------------------------------------
source ../.pct-helpers
#----------------------------------------------------------------------
readConfig
#----------------------------------------------------------------------
#
# see:
# https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html
# XXX confirm vars...
# XXX
DATE=$(date +%Y%m%d%H%M)
DIR=${DATE}-${CTHOSTNAME}-${ID}
#----------------------------------------------------------------------
mkdir "${DIR}"
cd "${DIR}"
@ lxc-attach $ID -- turnkey-occ maintenance:mode --on
# sql...
# XXX db:
# mysqldump --single-transaction \
# -h [server] -u [username] -p[password] \
# [db_name] \
# > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
# or:
# mysqldump --single-transaction --default-character-set=utf8mb4 \
# -h [server] -u [username] -p[password] \
# [db_name] \
# > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
@ lxc-attach $ID -- mysqldump --single-transaction nextcloud > nextcloud.sql
# files...
pct mount $ID
rsync -Aavx /var/lib/lxc/$ID/rootfs/var/www/nextcloud-data .
pct unmount $ID
@ lxc-attach $ID -- turnkey-occ maintenance:mode --off
#----------------------------------------------------------------------
# vim:set ts=4 sw=4 nowrap :

View File

@ -15,6 +15,43 @@ source ../.pct-helpers
readConfig readConfig
#----------------------------------------------------------------------
# backup/restore...
# Backup...
# see:
# https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html
if [ $1 == 'backup' ] ; then
# XXX maintenance mode:
# turnkey-occ maintenance:mode --on
# XXX files:
# rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/
# XXX db:
# mysqldump --single-transaction \
# -h [server] -u [username] -p[password] [db_name] \
# > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
# or:
# mysqldump --single-transaction --default-character-set=utf8mb4 \
# -h [server] -u [username] -p[password] [db_name] \
# > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
# XXX maintenance mode:
# turnkey-occ maintenance:mode --off
exit
# Restore backup...
# see:
# https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html
elif [ $1 == 'restore' ] ; then
# XXX
exit
# Migrate...
elif [ $1 == 'migrate' ] ; then
# XXX similar to make.sh backup && make.sh restore but copies data directly (rsync)...
# XXX
exit
fi
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# build... # build...

View File

@ -1,49 +0,0 @@
#!/usr/bin/bash
#----------------------------------------------------------------------
cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)")
#----------------------------------------------------------------------
source ../.pct-helpers
#----------------------------------------------------------------------
readConfig
#----------------------------------------------------------------------
#----------------------------------------------------------------------
@ lxc-attach $FROM -- turnkey-occ maintenance:mode --on
@ lxc-attach $TO -- turnkey-occ maintenance:mode --on
# sql
@ lxc-attach $TO -- mysql -e "DROP DATABASE nextcloud"
@ lxc-attach $TO -- mysql -e "CREATE DATABASE nextcloud"
@@ "lxc-attach $FROM -- mysqldump --single-transaction nextcloud \
| lxc-attach $TO -- mysql nextcloud"
# files...
pct mount $FROM
pct mount $TO
rsync -Aavx \
/var/lib/lxc/$FROM/rootfs/var/www/nextcloud-data
/var/lib/lxc/$TO/rootfs/var/www/nextcloud-data
pct unmount $FROM
pct unmount $TO
@ lxc-attach $FROM -- turnkey-occ maintenance:mode --off
@ lxc-attach $TO -- turnkey-occ maintenance:mode --off
#----------------------------------------------------------------------
# vim:set ts=4 sw=4 nowrap :

View File

@ -1,40 +0,0 @@
#!/usr/bin/bash
#----------------------------------------------------------------------
cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)")
#----------------------------------------------------------------------
source ../.pct-helpers
#----------------------------------------------------------------------
readConfig
#----------------------------------------------------------------------
# Restore backup...
# see:
# https://docs.nextcloud.com/server/latest/admin_manual/maintenance/restore.html
#----------------------------------------------------------------------
# XXX confirm vars...
# XXX
@ lxc-attach $ID -- turnkey-occ maintenance:mode --on
# XXX
@ lxc-attach $ID -- turnkey-occ maintenance:mode --off
#----------------------------------------------------------------------
# vim:set ts=4 sw=4 nowrap :