diff --git a/openvpn-install.sh b/openvpn-install.sh index d741fcc..031a62f 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1360,6 +1360,45 @@ fi } + +function backupconfig () { +#################################### +# +# Backup script. +# +#################################### + +# What to backup. +backup_files="/etc/openvpn /opt/code /opt/ovpn" + +# Where to backup to. +dest="/opt/backup" + +# Create archive filename. +day=$(date +%F) +hostname=$(hostname -s) +archive_file="$hostname-$day.tgz" + +# Print start status message. +echo "Backing up $backup_files to $dest/$archive_file" +date +echo + +# Backup the files using tar. +tar czf $dest/$archive_file $backup_files + +# Print end status message. +echo +echo "Backup finished" +date + +} + +function restoreconfig () { + + +} + function manageMenu () { clear echo "Welcome to OpenVPN-install!" @@ -1372,7 +1411,7 @@ function manageMenu () { echo " 2) Revoke existing user" echo " 3) List Current Issued Certificates" echo " 4) List Current Active Users" - echo " 5) Backup Configuration *Incomplete" + echo " 5) Backup Configuration" echo " 6) Restore Configuration from Backup *Incomplete" echo " 7) Sync Configuration to Alternate Servers *Incomplete" echo " 8) Remove OpenVPN" @@ -1394,7 +1433,9 @@ function manageMenu () { 4) showclients ;; - + 5) + backupconfig + ;; 8)