Last active
May 23, 2020 16:18
-
-
Save Lp-Francois/639c4114dc4ad23e170ba29ecc21a295 to your computer and use it in GitHub Desktop.
A backup bash script to save rs_bitwarden data and miniflux DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# back-up script | |
echo " " | |
echo "[~_~Z~@] Start back-up script" | |
DATE=$(date +"%y-%m-%d_%H_%M_%S") | |
REMOTE_NAME="remote" | |
REMOTE_FOLDER="backups" | |
BACKUP_PATH="/tmp/backup" | |
BW_FILE_NAME=backup_bw-data_${DATE}.tar | |
MINIFLUX_FILE_NAME=backup_miniflux_postgres_${DATE}.tar | |
VOLUME_NAME="YOUR_miniflux-db" | |
######################### | |
# Backup bitwarden data # | |
######################### | |
echo "[>] Start back-up bitwarden" | |
echo " [+] Tar the folder" | |
mkdir -p ${BACKUP_PATH} | |
tar -zcf ${BACKUP_PATH}/${BW_FILE_NAME} bw-data | |
# -z : Compress archive using gzip program in Linux or Unix | |
# -c : Create archive on Linux | |
# -f : Archive File name | |
echo " [+] Copy in Mega" | |
rclone copy ${BACKUP_PATH}/${BW_FILE_NAME} ${REMOTE_NAME}:${REMOTE_FOLDER} | |
############################ | |
# Miniflux backup postgres # | |
############################ | |
echo "[>] Start back-up miniflux" | |
echo " [+] Export & tar the docker miniflux db volume" | |
docker run --rm -v ${VOLUME_NAME}:/vol -w /vol alpine tar -c . > ${BACKUP_PATH}/${MINIFLUX_FILE_NAME} | |
echo " [+] Copy in Mega" | |
rclone copy ${BACKUP_PATH}/${MINIFLUX_FILE_NAME} ${REMOTE_NAME}:${REMOTE_FOLDER} | |
############ | |
# clean-up # | |
############ | |
echo "[~_~Z] Delete local tar" | |
rm ${BACKUP_PATH}/backup_* | |
########################################## | |
# Delete online backups older than 7days # | |
########################################## | |
echo "[~_~Z] Delete online backups older than 7days" | |
rclone delete --min-age 7d ${REMOTE_NAME}:${REMOTE_FOLDER} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mega offers 50G free, which is great to quickly backup data from personal projects :)
https://rclone.org/
https://mega.nz/