1
0
mirror of https://github.com/xzeldon/vwdump.git synced 2025-06-28 02:28:14 +03:00
vwdump/entrypoint.sh
jmqm 02c9d71114
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.
2021-05-25 20:34:39 -05:00

34 lines
839 B
Bash
Executable File

#!/bin/sh
BACKUP_CMD="/sbin/su-exec ${UID}:${GID} /app/backup.sh"
echo "Running $(basename "$0") as $(id)"
# Run backup script once ($1 = First argument passed).
if [ "$1" = "manual" ]; then
$BACKUP_CMD
exit 0
fi
# Initialize cron
if [ "$(id -u)" -eq 0 ] && [ "$(grep -c "$BACKUP_CMD" "$CRONFILE")" -eq 0 ]; then
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
pgrep crond > /dev/null 2>&1
if [ $? -ne 0 ]; then
/usr/sbin/crond -L /app/log/cron.log
fi
# Restart script as user "app:app"
if [ "$(id -u)" -eq 0 ]; then
echo "Restarting $(basename "$0") as app:app"
exec su-exec app:app "$0" "$@"
fi
echo "$(date "+%F %T") - Container started" > "$LOGFILE"
tail -F "$LOGFILE" /app/log/cron.log