mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-05-12 12:57:07 +02:00
Allow restic to be run from outside
This commit is contained in:
@@ -30,13 +30,9 @@ if [ -d /crontabs ] ; then
|
||||
for f in /crontabs/* ; do
|
||||
crontab -u $(basename $f) $f
|
||||
done
|
||||
else
|
||||
elif [[ "$BACKUP_CRONTAB" ]] ; then
|
||||
echo "# This crontab is generated by the entrypoint script, do not edit" > /tmp/crontab
|
||||
if [[ "$BACKUP_CRONTAB" ]] ; then
|
||||
echo -n "$BACKUP_CRONTAB" >> /tmp/crontab
|
||||
else
|
||||
echo -n "0 4 * * *" >> /tmp/crontab
|
||||
fi
|
||||
if [[ "$HC_PING_KEY" ]] ; then
|
||||
echo -n " runitor -slug ${HOSTNAME}-restic-backup --" >> /tmp/crontab
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Backup one directory
|
||||
# Backup one directory (from the mounted filesystem)
|
||||
function backup_dir {
|
||||
# Check if the dir to backup is mounted as a subdirectory of /root inside this container
|
||||
if [ "$1" = "" ]; then
|
||||
@@ -15,6 +15,7 @@ function backup_dir {
|
||||
fi
|
||||
}
|
||||
|
||||
# Backup one directory (from the local filesystem)
|
||||
function backup_local_dir {
|
||||
if [ "$1" = "" ]; then
|
||||
echo "[ERROR] Cannot backup the root directory. Have you correctly configured the volumes to backup for this container ?"
|
||||
@@ -46,6 +47,7 @@ if [ "$(restic --no-lock list locks -q)" != "" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ] || [ "$1" == "backup" ]; then
|
||||
count_success=0
|
||||
count_failure=0
|
||||
|
||||
@@ -153,3 +155,7 @@ fi
|
||||
if [ $count_failure -ne 0 ]; then
|
||||
exit -1
|
||||
fi
|
||||
elif [ "$1" == "maintenance" ] ; then
|
||||
restic forget -q --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 2 --prune && restic prune -q
|
||||
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user