我正在尝试使用此 bash 脚本创建 tar.gz 文件并将其发送到我的备份服务器,由于某种原因它似乎没有复制它,是否有更好的解决方案来解决我正在尝试做的事情?
我宁愿在通过网络发送之前对其进行压缩
#!/bin/bash
####################################
#
# Backup to NFS mount script.
#
####################################
# What to backup.
backup_files="/home/amp/.ampdata/instances/Towny/"
# Where to backup to.
dest="/home/amp/Backups"
# Create archive filename.
day=$(date +%A)
time=$(date +%H-%M)
file=$(file)
archive_file="$file-$day-$time.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
rsync $archive_file [email protected]:~/backup
# Print end status message.
echo
echo "Backup finished"
date