mirror of
https://github.com/xzeldon/vwdump.git
synced 2025-07-13 03:54:39 +03:00
Overhaul (#4)
**README** - Overhaul; changed docs to be better aligned to the new `backup.sh`. - Add example `docker-compose`. **Dockerfile** - Install `zip`. - Remove installation of `sqlite`. - Remove unnecessary variables. **backup.sh** - Overhaul; now zips all required and recommended files and directories stated at [vaultwarden docs](https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault). - Removed deleting old backups; will be added later on in a separate script. **entrypoint.sh** - Removed creating folders.
This commit is contained in:
@ -1,41 +1,10 @@
|
||||
#!/bin/sh
|
||||
# vim: tabstop=2 shiftwidth=2 expandtab
|
||||
|
||||
#set -x
|
||||
|
||||
BACKUP_CMD="/sbin/su-exec ${UID}:${GID} /app/backup.sh"
|
||||
|
||||
echo "Running $(basename "$0") as $(id)"
|
||||
|
||||
# Preparation
|
||||
BACKUP_DIR=$(dirname "$BACKUP_FILE")
|
||||
if [ ! -d "$BACKUP_DIR" ]
|
||||
then
|
||||
echo "$BACKUP_DIR not exists. Creating it with owner $UID:$GID and permissions $BACKUP_FILE_PERMISSIONS."
|
||||
install -o $UID -g $GID -m $BACKUP_FILE_PERMISSIONS -d $BACKUP_DIR
|
||||
fi
|
||||
|
||||
ATTACHMENT_BACKUP_DIR=$(dirname "$ATTACHMENT_BACKUP_FILE")
|
||||
if [ ! -d "$ATTACHMENT_BACKUP_DIR" ]
|
||||
then
|
||||
echo "$ATTACHMENT_BACKUP_DIR not exists. Creating it with owner $UID:$GID and permissions $BACKUP_FILE_PERMISSIONS."
|
||||
install -o $UID -g $GID -m $BACKUP_FILE_PERMISSIONS -d $ATTACHMENT_BACKUP_DIR
|
||||
fi
|
||||
|
||||
SEND_BACKUP_DIR=$(dirname "$SEND_BACKUP_FILE")
|
||||
if [ ! -d "$SEND_BACKUP_DIR" ]
|
||||
then
|
||||
echo "$SEND_BACKUP_DIR not exists. Creating it with owner $UID:$GID and permissions $BACKUP_FILE_PERMISSIONS."
|
||||
install -o $UID -g $GID -m $BACKUP_FILE_PERMISSIONS -d $SEND_BACKUP_DIR
|
||||
fi
|
||||
|
||||
# For compatibility reasons
|
||||
if [ "$1" = "/backup.sh" ]; then
|
||||
>&2 echo "Using /backup.sh is deprecated and will be removed in future versions! Please use \`manual\` as argument instead"
|
||||
$BACKUP_CMD
|
||||
fi
|
||||
|
||||
# Just run the backup script
|
||||
# Run backup script once ($1 = First argument passed).
|
||||
if [ "$1" = "manual" ]; then
|
||||
$BACKUP_CMD
|
||||
exit 0
|
||||
@ -46,7 +15,6 @@ if [ "$(id -u)" -eq 0 ] && [ "$(grep -c "$BACKUP_CMD" "$CRONFILE")" -eq 0 ]; the
|
||||
echo "Initalizing..."
|
||||
echo "Writing backup command \"$BACKUP_CMD\" to cron."
|
||||
echo "$CRON_TIME $BACKUP_CMD >> $LOGFILE 2>&1" | crontab -
|
||||
|
||||
fi
|
||||
|
||||
# Start crond if it's not running
|
||||
|
Reference in New Issue
Block a user