Files
scripts/Bit-Frigger-Tarballer
2020-09-05 17:02:29 +03:00

24 lines
723 B
Bash
Executable File

#!/bin/bash
# Script to export the Bit Frigger's rootfs to a zstd tarball periodically
FINAL_DIR="/Red-Vol/Backups/Bit-Frigger/Tarball"
#Check for root permissions
if [[ $(whoami) != "root" ]]; then
echo "Please run this script as root or with sudo."
exit
fi
#Create directory if it does not exist
if [[ ! -d $FINAL_DIR ]]; then
mkdir $FINAL_DIR
fi
#Sync everything to it
echo "Gathering files for the tarball"
rsync -aHAXSv --progress --exclude=/dev --exclude=/Red-Vol --exclude=/proc --exclude=/rksmb "/" "$FINAL_DIR"
#And tar it with ZSTD
echo "Compressing tarball"
cd $FINAL_DIR
if [[ -f "$FINAL_DIR/Bit-Frigger.tar" ]]; then
tar rvfJ Bit-Frigger.tar.xz $FINAL_DIR
else
tar cvfJ Bit-Frigger.tar.xz $FINAL_DIR
fi