|
@@ -14,7 +14,7 @@ fn_script_log "Entering backup"
|
|
|
# Check if a backup is pending or has been aborted using .backup.lock
|
|
# Check if a backup is pending or has been aborted using .backup.lock
|
|
|
if [ -f "${tmpdir}/.backup.lock" ]; then
|
|
if [ -f "${tmpdir}/.backup.lock" ]; then
|
|
|
fn_print_warning_nl "A backup is currently running or has been aborted."
|
|
fn_print_warning_nl "A backup is currently running or has been aborted."
|
|
|
- fn_script_log_warn "A backup is currently running or has been aborted."
|
|
|
|
|
|
|
+ fn_script_log_warn "A backup is currently running or has been aborted"
|
|
|
while true; do
|
|
while true; do
|
|
|
read -e -i "y" -p "Continue anyway? [Y/N]" yn
|
|
read -e -i "y" -p "Continue anyway? [Y/N]" yn
|
|
|
case $yn in
|
|
case $yn in
|
|
@@ -49,7 +49,7 @@ check_status.sh
|
|
|
if [ "${status}" != "0" ]; then
|
|
if [ "${status}" != "0" ]; then
|
|
|
echo ""
|
|
echo ""
|
|
|
fn_print_warning_nl "${servicename} is currently running."
|
|
fn_print_warning_nl "${servicename} is currently running."
|
|
|
- fn_script_log_warn "${servicename} is currently running."
|
|
|
|
|
|
|
+ fn_script_log_warn "${servicename} is currently running"
|
|
|
sleep 0.5
|
|
sleep 0.5
|
|
|
while true; do
|
|
while true; do
|
|
|
read -e -i "n" -p "Stop ${servicename} while running the backup? [y/N]" yn
|
|
read -e -i "n" -p "Stop ${servicename} while running the backup? [y/N]" yn
|
|
@@ -85,9 +85,9 @@ if [ -d "${tmpdir}" ]; then
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Compressing files
|
|
# Compressing files
|
|
|
-fn_script_log "Compressing ${rootdirduexbackup}..."
|
|
|
|
|
|
|
+fn_script_log "Compressing ${rootdirduexbackup}"
|
|
|
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./*
|
|
tar -czf "${backupdir}/${backupname}.tar.gz" -C "${rootdir}" --exclude "backups" ./*
|
|
|
-fn_script_log "Compression over."
|
|
|
|
|
|
|
+fn_script_log "Compression over"
|
|
|
|
|
|
|
|
# Remove lockfile
|
|
# Remove lockfile
|
|
|
if [ -d "${tmpdir}" ]; then
|
|
if [ -d "${tmpdir}" ]; then
|
|
@@ -108,7 +108,7 @@ if [ $? == 0 ]; then
|
|
|
# Check if there is any backup to clear
|
|
# Check if there is any backup to clear
|
|
|
if [ "${backupclearcount}" -ne "0" ]; then
|
|
if [ "${backupclearcount}" -ne "0" ]; then
|
|
|
fn_print_info_nl "${backupclearcount} backups older than ${backupdays} days can be cleared."
|
|
fn_print_info_nl "${backupclearcount} backups older than ${backupdays} days can be cleared."
|
|
|
- fn_script_log "${backupclearcount} backups older than ${backupdays} days can be cleared."
|
|
|
|
|
|
|
+ fn_script_log "${backupclearcount} backups older than ${backupdays} days can be cleared"
|
|
|
while true; do
|
|
while true; do
|
|
|
read -p -e"Clear older backups? [Y/N]" yn
|
|
read -p -e"Clear older backups? [Y/N]" yn
|
|
|
case $yn in
|
|
case $yn in
|
|
@@ -121,13 +121,13 @@ if [ $? == 0 ]; then
|
|
|
if [ "${clearoldbackups}" == "yes" ]; then
|
|
if [ "${clearoldbackups}" == "yes" ]; then
|
|
|
find "${backupdir}"/ -mtime +"${backupdays}" -type f -exec rm -f {} \;
|
|
find "${backupdir}"/ -mtime +"${backupdays}" -type f -exec rm -f {} \;
|
|
|
fn_print_ok_nl "Cleared ${backupclearcount} backups."
|
|
fn_print_ok_nl "Cleared ${backupclearcount} backups."
|
|
|
- fn_script_log_pass "Cleared ${backupclearcount} backups."
|
|
|
|
|
|
|
+ fn_script_log_pass "Cleared ${backupclearcount} backups"
|
|
|
fi
|
|
fi
|
|
|
else
|
|
else
|
|
|
- fn_script_log "No backups older than ${backupdays} days were found."
|
|
|
|
|
|
|
+ fn_script_log "No backups older than ${backupdays} days were found"
|
|
|
fi
|
|
fi
|
|
|
else
|
|
else
|
|
|
- fn_script_log "No backups to clear since backupdays variable is empty."
|
|
|
|
|
|
|
+ fn_script_log "No backups to clear since backupdays variable is empty"
|
|
|
fi
|
|
fi
|
|
|
# Restart the server if it was stopped for the backup
|
|
# Restart the server if it was stopped for the backup
|
|
|
if [ "${serverstopped}" == "yes" ]; then
|
|
if [ "${serverstopped}" == "yes" ]; then
|