1
0
mirror of https://github.com/Spearfoot/FreeNAS-scripts synced 2025-12-17 00:33:28 +00:00

Original version

This commit is contained in:
Keith Nash
2017-03-15 22:38:31 -05:00
committed by GitHub
parent 05c04e3cae
commit 3da04c1f81

34
save-config.sh Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#################################################
# Backup the FreeNAS configuration file
#################################################
# Specify the dataset on your system where you want the configuration files copied.
# Don't include the trailing slash.
# Example: configdir=/mnt/tank/sysadmin/config
configdir=
# Remove this code once you've defined configdir above... :-)
if [ -z ${configdir} ]; then
echo "Edit script and specify the target directory ('configdir') before using $0"
exit 2
fi
freenashost=$(hostname -s)
fnconfigdest_version=$(cat /etc/version)
fnconfigdest_version="${fnconfigdest_version//(/}"
fnconfigdest_version="${fnconfigdest_version//)/}"
fnconfigdest_version="${fnconfigdest_version// /-}"
fnconfigdest_date=$(date +%Y%m%d%H%M%S)
fnconfigdest="${configdir}"/"${freenashost}"-"${fnconfigdest_version}"-"${fnconfigdest_date}".db
echo "Backup configuration database file: ${fnconfigdest}"
# Copy the source to the destination:
cp /data/freenas-v1.db "${fnconfigdest}"