Skip to content

Instantly share code, notes, and snippets.

@varunsridharan
Created October 21, 2019 11:12
Show Gist options
  • Save varunsridharan/960079a32d348d469ae7983bde23406b to your computer and use it in GitHub Desktop.
Save varunsridharan/960079a32d348d469ae7983bde23406b to your computer and use it in GitHub Desktop.
Freenas Auto backup to local drive in nas itself
#!/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
@varunsridharan
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment