mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
Rework bin directory
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
|
|
||||||
echo '** Performing Manual Backup'
|
|
||||||
/etc/services.available/10-db-backup/run manual
|
|
||||||
24
install/usr/local/bin/logrotate_dbbackup
Executable file
24
install/usr/local/bin/logrotate_dbbackup
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
|
||||||
|
source /assets/functions/00-container
|
||||||
|
source /assets/defaults/05-logging
|
||||||
|
source /assets/defaults/10-db-backup
|
||||||
|
|
||||||
|
## Compress each log 2 days old
|
||||||
|
timestamp_2dayold_unixtime="$(stat -c %Y "${LOG_PATH}"/"$(date --date='2 days ago' +'%Y%m%d')")"
|
||||||
|
for logfile in "${LOG_PATH}"/"$(date --date='2 days ago' +'%Y%m%d')"/"$(date --date='2 days ago' +'%Y%m%d')"_*.log ; do
|
||||||
|
sudo -u restic zstd --rm --rsyncable "${logfile}"
|
||||||
|
done
|
||||||
|
touch -t $(date -d"@${timestamp_2dayold_unixtime}" +'%Y%m%d%H%m.%S') "${LOG_PATH}"/"$(date --date='2 days ago' +'%Y%m%d')"
|
||||||
|
|
||||||
|
# Look fook files older than certain day and delete
|
||||||
|
if [ -n "${LOG_PATH}" ] && [ -d "${LOG_PATH}" ] ; then
|
||||||
|
find "${LOG_PATH}" -mtime +"${LOGROTATE_RETAIN_DAYS}" -type d -exec rm -rf {} +
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Look for stale symbolic links and delete accordingly
|
||||||
|
for symbolic_link in "${LOG_PATH}"/latest*.log ; do
|
||||||
|
if [ ! -e "${symbolic_link}" ] ; then
|
||||||
|
rm -rf "${symbolic_link}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -38,7 +38,7 @@ else
|
|||||||
"-h" )
|
"-h" )
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
${IMAGE_NAME} Restore Tool ${IMAGE_VERSION}
|
${IMAGE_NAME} Restore Tool ${IMAGE_VERSION}
|
||||||
(c) 2022 Dave Conroy (https://github.com/tiredofit)
|
(c) 2023 Dave Conroy (https://github.com/tiredofit) (https://www.tiredofit.ca)
|
||||||
|
|
||||||
This script will assist you in recovering databases taken by the Docker image.
|
This script will assist you in recovering databases taken by the Docker image.
|
||||||
You will be presented with a series of menus allowing you to choose:
|
You will be presented with a series of menus allowing you to choose:
|
||||||
|
|||||||
Reference in New Issue
Block a user