Bash-Backup-Script
Bash-Backup-Script copied to clipboard
Great script
Greetings,
I am attempting to use your script ran into a small snag that I can solve. I have a backupscript that backs up two directories on my server and puts them in /backup/bbs with the date appended on the filename. I want to use your script to only take the most recent of each of the two and upload to an ftp server. Here is what I altered in your script;
FILE1=$ ls ~/backup/bbs/mystic* | sort -k1.5 -k1.1,1.2 -k1.3,1.4 | tail -n 1 (this does pull the most recent) #Directory where thing to backup is located DIR=$FILE1
this is the output I get running your script
/home/pi/backup/bbs/mystic-29-08-2021.tar.gz tar: Cowardly refusing to create an empty archive Try 'tar --help' or 'tar --usage' for more information. Tar Complete local: pi_*_2021-09-04.tar.gz: No such file or directory Remote Backup Complete Local Backup Removed
So it did Identify the correct file, but I must have something wrong?
Any help appreciated I know you did this a long time ago.
@wcmedic
FILE1=$ ls ~/backup/bbs/mystic* | sort -k1.5 -k1.1,1.2 -k1.3,1.4 | tail -n 1
(this does pull the most recent)
#Directory where thing to backup is located
DIR=$FILE1
This is totally wrong! DIR= is a directory WHAT you want to backup! You will backup all DIR not particular files!