mirror of
https://github.com/Spearfoot/FreeNAS-scripts
synced 2025-12-06 01:23:19 +00:00
32 lines
912 B
Bash
32 lines
912 B
Bash
#!/bin/sh
|
|
|
|
#################################################
|
|
# 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=$(< /etc/version sed -e 's/)//;s/(//;s/ /-/' | tr -d '\n')
|
|
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}"
|