Created
October 21, 2019 11:12
-
-
Save varunsridharan/960079a32d348d469ae7983bde23406b to your computer and use it in GitHub Desktop.
Freenas Auto backup to local drive in nas itself
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
#!/bin/bash | |
DAY_DIR=$(date +%d) | |
MONTH_DIR=$(date +%m) | |
YEAR_DIR=$(date +%Y) | |
mkdir -p "${YEAR_DIR}/${MONTH_DIR}/${DAY_DIR}" | |
cd "${YEAR_DIR}/${MONTH_DIR}/${DAY_DIR}" | |
cp /data/freenas-v1.db `date +%H%M%I`_`cat /etc/version | cut -d'-' -f2`_`cat /etc/version | cut -d'-' -f4`.db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use the below cmd if the sh file not working
mkdir -p /mnt/S6X6TB/Backups/Vault1-Freenas/$(date +%Y)/$(date +%m)/$(date +%d)/ && cd /mnt/S6X6TB/Backups/Vault1-Freenas/$(date +%Y)/$(date +%m)/$(date +%d) && cp /data/freenas-v1.db
date +%H%M%I_
cat /etc/version | cut -d'-' -f2_
cat /etc/version | cut -d'-' -f4.db