mirror of
https://github.com/sstent/containers.git
synced 2025-12-06 08:01:51 +00:00
add no litestream option
This commit is contained in:
@@ -28,6 +28,7 @@ if [ "$NOMAD_TASK_NAME" == "init" ]; then
|
||||
rm -rf /config/*.db*
|
||||
rm -rf /config/database.sqlite
|
||||
|
||||
if [[ -f /local/litestream.yml ]]; then
|
||||
|
||||
echo "Starting DB Restore"
|
||||
if /usr/local/bin/litestream restore -config /local/litestream.yml /config/${DB_NAME}; then
|
||||
@@ -52,7 +53,25 @@ if [ "$NOMAD_TASK_NAME" == "init" ]; then
|
||||
unzip -o $latest -d /config
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
echo "NO LITESTREAM DETECTED - trying to restore backup"
|
||||
unset -v latest
|
||||
if [ -d "/configbackup/Backups/scheduled" ]; then
|
||||
for file in "/configbackup/Backups/scheduled"/*; do
|
||||
[[ $file -nt $latest ]] && latest=$file
|
||||
done
|
||||
fi
|
||||
if [ -d "/configbackup/Backups/manual" ]; then
|
||||
for file in "/configbackup/Backups/manual"/*; do
|
||||
[[ $file -nt $latest ]] && latest=$file
|
||||
done
|
||||
fi
|
||||
if [ -z "$latest" ]; then
|
||||
echo "No Backups found";
|
||||
else
|
||||
echo "Restoring $latest"
|
||||
unzip -o $latest -d /config
|
||||
fi
|
||||
|
||||
|
||||
chown ${PUID:-1000}:${PGID:-1000} /config/*.db*
|
||||
|
||||
Reference in New Issue
Block a user