Created
November 13, 2022 10:23
-
-
Save karl-gustav/3c81feb3208473c8c68d595f8b9c9863 to your computer and use it in GitHub Desktop.
Backup script with aes-256-cbc encryption and automatically spits the output into 4GB chunks (for fat32 file systems)
This file contains hidden or 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
#! /bin/bash | |
if ! [ $# -eq 1 ] ;then | |
echo "Ha mappen du vil ha backup av som argument" | |
exit 1 | |
fi | |
echo "Navn på backupen:" | |
read name | |
echo "Passord:" | |
read pass | |
folder=$1 | |
org_size=`du -bs $folder |cut -f1` | |
echo "Størrelse i byte: "$org_size | |
date=`date +%Y.%m.%d` | |
echo "Starter:" | |
tar cf - "$folder" |pv -cN Filer -s $org_size |gzip - |openssl aes-256-cbc -pass pass:"$pass" |split -a3 -b 4000m - "$date-$name.tgz.aes-256-cbc-" | |
md5sum "$date-$name.tgz.aes-256-cbc-"* > "$date-$name.tgz.aes-256-cbc.md5" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same thing as a single command: