Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Great script #8

Open
wcmedic opened this issue Sep 4, 2021 · 3 comments
Open

Great script #8

wcmedic opened this issue Sep 4, 2021 · 3 comments

Comments

@wcmedic
Copy link

wcmedic commented Sep 4, 2021

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.

@sasha2002
Copy link

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@sasha2002 @wcmedic and others