Updated Backup Script
This commit is contained in:
parent
bbf489f9ae
commit
47d6888edd
1 changed files with 43 additions and 2 deletions
|
|
@ -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 () {
|
function manageMenu () {
|
||||||
clear
|
clear
|
||||||
echo "Welcome to OpenVPN-install!"
|
echo "Welcome to OpenVPN-install!"
|
||||||
|
|
@ -1372,7 +1411,7 @@ function manageMenu () {
|
||||||
echo " 2) Revoke existing user"
|
echo " 2) Revoke existing user"
|
||||||
echo " 3) List Current Issued Certificates"
|
echo " 3) List Current Issued Certificates"
|
||||||
echo " 4) List Current Active Users"
|
echo " 4) List Current Active Users"
|
||||||
echo " 5) Backup Configuration *Incomplete"
|
echo " 5) Backup Configuration"
|
||||||
echo " 6) Restore Configuration from Backup *Incomplete"
|
echo " 6) Restore Configuration from Backup *Incomplete"
|
||||||
echo " 7) Sync Configuration to Alternate Servers *Incomplete"
|
echo " 7) Sync Configuration to Alternate Servers *Incomplete"
|
||||||
echo " 8) Remove OpenVPN"
|
echo " 8) Remove OpenVPN"
|
||||||
|
|
@ -1394,7 +1433,9 @@ function manageMenu () {
|
||||||
4)
|
4)
|
||||||
showclients
|
showclients
|
||||||
;;
|
;;
|
||||||
|
5)
|
||||||
|
backupconfig
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
8)
|
8)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue