Tidying
This commit is contained in:
parent
e3a7b9ab4e
commit
dbb6eb21ec
|
@ -347,19 +347,8 @@ function remove_backup_directory {
|
|||
fi
|
||||
}
|
||||
|
||||
# has the remove option been set ?
|
||||
remove_option=$2
|
||||
if [[ $1 == "remove" ]]; then
|
||||
remove_option=$1
|
||||
fi
|
||||
|
||||
mount_drive $1 $2
|
||||
remove_backup_directory $remove_option
|
||||
make_backup_directory
|
||||
check_storage_space_remaining
|
||||
update_domains
|
||||
backup_users
|
||||
|
||||
function prepare_directories {
|
||||
# Some miscellaneous preparation for backing up directories
|
||||
if [ -d /home/git/go/src/github.com/gogits ]; then
|
||||
mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/$ADMIN_USERNAME
|
||||
fi
|
||||
|
@ -369,10 +358,9 @@ if [ -d /var/lib/tox-bootstrapd ]; then
|
|||
rm -rf /var/lib/tox-bootstrapd/Maildir
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
backup_directories
|
||||
|
||||
# configuration files
|
||||
function backup_configuration {
|
||||
echo $"Backing up ${PROJECT_NAME} configuration files"
|
||||
if [ ! -d /root/tempbackupconfig ]; then
|
||||
mkdir -p /root/tempbackupconfig
|
||||
|
@ -380,8 +368,9 @@ fi
|
|||
cp -f $CONFIG_FILE /root/tempbackupconfig
|
||||
cp -f $COMPLETION_FILE /root/tempbackupconfig
|
||||
backup_directory_to_usb /root/tempbackupconfig config
|
||||
}
|
||||
|
||||
# Backup admin user README file
|
||||
function backup_admin_readme {
|
||||
if [ -f /home/$ADMIN_USERNAME/README ]; then
|
||||
echo $"Backing up README"
|
||||
if [ ! -d /home/$ADMIN_USERNAME/tempbackup ]; then
|
||||
|
@ -390,8 +379,9 @@ if [ -f /home/$ADMIN_USERNAME/README ]; then
|
|||
cp -f /home/$ADMIN_USERNAME/README /home/$ADMIN_USERNAME/tempbackup
|
||||
backup_directory_to_usb /home/$ADMIN_USERNAME/tempbackup readme
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup VoIP settings
|
||||
function backup_voip {
|
||||
if [ -f /etc/mumble-server.ini ]; then
|
||||
echo $"Backing up VoIP settings"
|
||||
if [ ! -d /root/tempvoipbackup ]; then
|
||||
|
@ -402,8 +392,9 @@ if [ -f /etc/mumble-server.ini ]; then
|
|||
cp -f /etc/sipwitch.conf /root/tempvoipbackup
|
||||
backup_directory_to_usb /root/tempvoipbackup voip
|
||||
fi
|
||||
}
|
||||
|
||||
# MariaDB settings
|
||||
function backup_mariadb {
|
||||
if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
||||
if [ ! -d /root/tempmariadb ]; then
|
||||
mkdir /root/tempmariadb
|
||||
|
@ -420,7 +411,26 @@ if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
|||
chmod 400 /root/tempmariadb/db
|
||||
backup_directory_to_usb /root/tempmariadb mariadb
|
||||
fi
|
||||
}
|
||||
|
||||
# has the remove option been set ?
|
||||
remove_option=$2
|
||||
if [[ $1 == "remove" ]]; then
|
||||
remove_option=$1
|
||||
fi
|
||||
|
||||
mount_drive $1 $2
|
||||
remove_backup_directory $remove_option
|
||||
make_backup_directory
|
||||
check_storage_space_remaining
|
||||
update_domains
|
||||
backup_users
|
||||
prepare_directories
|
||||
backup_directories
|
||||
backup_configuration
|
||||
backup_admin_readme
|
||||
backup_voip
|
||||
backup_mariadb
|
||||
unmount_drive
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue