2021-04-02 13:59:47 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Copyright 2021 - Offen Authors <hioffen@posteo.de>
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-03-04 13:51:26 +01:00
|
|
|
if [ ! -d "/etc/dockervolumebackup/conf.d" ]; then
|
|
|
|
BACKUP_CRON_EXPRESSION="${BACKUP_CRON_EXPRESSION:-@daily}"
|
2021-04-02 13:59:47 +02:00
|
|
|
|
2022-03-04 13:51:26 +01:00
|
|
|
echo "Installing cron.d entry with expression $BACKUP_CRON_EXPRESSION."
|
|
|
|
echo "$BACKUP_CRON_EXPRESSION backup 2>&1" | crontab -
|
|
|
|
else
|
|
|
|
echo "/etc/dockervolumebackup/conf.d was found, using configuration files from this directory."
|
|
|
|
|
2022-08-15 15:00:58 +02:00
|
|
|
crontab -r && crontab /dev/null
|
2022-03-04 13:51:26 +01:00
|
|
|
for file in /etc/dockervolumebackup/conf.d/*; do
|
|
|
|
source $file
|
|
|
|
BACKUP_CRON_EXPRESSION="${BACKUP_CRON_EXPRESSION:-@daily}"
|
|
|
|
echo "Appending cron.d entry with expression $BACKUP_CRON_EXPRESSION and configuration file $file"
|
|
|
|
(crontab -l; echo "$BACKUP_CRON_EXPRESSION /bin/sh -c 'set -a; source $file; set +a && backup' 2>&1") | crontab -
|
|
|
|
done
|
|
|
|
fi
|
2021-04-02 13:59:47 +02:00
|
|
|
|
2021-04-03 09:33:11 +02:00
|
|
|
echo "Starting cron in foreground."
|
2022-07-06 13:16:43 +02:00
|
|
|
crond -f -d 8
|