Backup local apps
This commit is contained in:
parent
783d66fdf3
commit
f077dc7726
|
@ -255,63 +255,19 @@ function backup_directories {
|
|||
|
||||
# directories to be backed up (source,dest)
|
||||
backup_dirs=(
|
||||
"none, none, /etc/letsencrypt, letsencrypt"
|
||||
"none, none, /var/lib/dokuwiki, wiki"
|
||||
"none, none, /etc/dokuwiki, wiki2"
|
||||
"none, none, /etc/ssl, ssl"
|
||||
"/etc/share/tt-rss, ttrss, /root/tempttrssdata, ttrss"
|
||||
"none, none, /var/spool/mlmmj, mailinglist"
|
||||
"none, none, /var/lib/prosody, xmpp"
|
||||
"none, none, /etc/nginx/sites-available, web"
|
||||
"none, none, /home/$ADMIN_USERNAME/.ipfs, ipfs"
|
||||
"none, none, /var/cache/minidlna, dlna"
|
||||
"$GOPATH/src/github.com/gogits, gogs, /root/tempgogsdata, gogsdata"
|
||||
"none, none, $GOPATH/src/github.com/gogits/gogs/custom, gogs"
|
||||
"none, none, /home/git/gogs-repositories, gogsrepos"
|
||||
"none, none, /home/git/.ssh, gogsssh"
|
||||
"none, none, /var/lib/tox-bootstrapd, tox"
|
||||
"/var/www/${MICROBLOG_DOMAIN_NAME}, gnusocial, /root/tempgnusocialdata, gnusocialdata"
|
||||
"none, none, /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs, gnusocial"
|
||||
"none, none, /var/lib/syncthing/SyncShared, syncthingshared"
|
||||
"none, none, /root/.config/syncthing, syncthingconfig"
|
||||
"/var/www/${HUBZILLA_DOMAIN_NAME}, hubzilla, /root/temphubzilladata, hubzilladata"
|
||||
"none, none, /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs, hubzilla"
|
||||
"none, none, /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs, blog"
|
||||
"none, none, /var/lib/tor, tor"
|
||||
"none, none, /var/www/${MEDIAGOBLIN_DOMAIN_NAME}/htdocs, mediagoblin"
|
||||
"/etc/letsencrypt, letsencrypt"
|
||||
"/etc/ssl, ssl"
|
||||
"/var/spool/mlmmj, mailinglist"
|
||||
"/etc/nginx/sites-available, web"
|
||||
"/var/lib/tor, tor"
|
||||
)
|
||||
|
||||
for dr in "${backup_dirs[@]}"
|
||||
do
|
||||
# if this directory exists then backup the given database
|
||||
required_directory=$(echo $dr | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
database_name=$(echo $dr | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
|
||||
if [[ "$database_name" == *"hubzilla"* ]]; then
|
||||
suspend_site ${HUBZILLA_DOMAIN_NAME}
|
||||
fi
|
||||
if [[ "$database_name" == *"gnusocial"* ]]; then
|
||||
suspend_site ${MICROBLOG_DOMAIN_NAME}
|
||||
fi
|
||||
if [[ "$database_name" == *"gogs"* ]]; then
|
||||
suspend_site ${GIT_DOMAIN_NAME}
|
||||
fi
|
||||
if [[ "$database_name" == *"ttrss"* ]]; then
|
||||
suspend_site ${RSS_READER_DOMAIN_NAME}
|
||||
fi
|
||||
|
||||
if [[ $required_directory != "none" ]]; then
|
||||
if [ -d $required_directory ]; then
|
||||
if [[ $database_name != "none" ]]; then
|
||||
backup_database_local $database_name
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# if this directory exists then back it up to the given destination
|
||||
source_directory=$(echo $dr | awk -F ',' '{print $3}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
source_directory=$(echo $dr | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
if [ -d $source_directory ]; then
|
||||
dest_directory=$(echo $dr | awk -F ',' '{print $4}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
dest_directory=$(echo $dr | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
echo $"Backing up $source_directory to $dest_directory"
|
||||
backup_directory_to_usb $source_directory $dest_directory
|
||||
fi
|
||||
|
@ -320,6 +276,25 @@ function backup_directories {
|
|||
done
|
||||
}
|
||||
|
||||
function backup_apps {
|
||||
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
|
||||
|
||||
APPS_COMPLETED=()
|
||||
|
||||
# for all the app scripts
|
||||
for filename in $FILES
|
||||
do
|
||||
app_name=$(echo "${filename}" | awk -F '-app-' '{print $2}')
|
||||
if [[ $(item_in_array ${app_name} ${APPS_COMPLETED[@]}) != 0 ]]; then
|
||||
if [[ "$(app_is_installed $a)" == "1" ]]; then
|
||||
APPS_COMPLETED+=("${app_name}")
|
||||
function_check backup_local_${app_name}
|
||||
backup_local_${app_name}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function remove_backup_directory {
|
||||
if [ $1 ]; then
|
||||
if [[ $1 == "remove" ]]; then
|
||||
|
@ -382,19 +357,6 @@ function backup_admin_readme {
|
|||
fi
|
||||
}
|
||||
|
||||
function backup_voip {
|
||||
if [ -f /etc/mumble-server.ini ]; then
|
||||
echo $"Backing up VoIP settings"
|
||||
if [ ! -d /root/tempvoipbackup ]; then
|
||||
mkdir -p /root/tempvoipbackup
|
||||
fi
|
||||
cp -f /etc/mumble-server.ini /root/tempvoipbackup
|
||||
cp -f /var/lib/mumble-server/mumble-server.sqlite /root/tempvoipbackup
|
||||
cp -f /etc/sipwitch.conf /root/tempvoipbackup
|
||||
backup_directory_to_usb /root/tempvoipbackup voip
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_mariadb {
|
||||
if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
||||
if [ ! -d /root/tempmariadb ]; then
|
||||
|
@ -485,9 +447,9 @@ update_domains
|
|||
backup_users
|
||||
prepare_directories
|
||||
backup_directories
|
||||
backup_apps
|
||||
backup_configuration
|
||||
backup_admin_readme
|
||||
backup_voip
|
||||
backup_mariadb
|
||||
backup_extra_directories
|
||||
backup_unmount_drive $USB_DRIVE $USB_MOUNT
|
||||
|
|
Loading…
Reference in New Issue