rsync --link-dest from a file

I am attempting to create a simple backup script and I'm struggling to get rsync to do incremental backups.

I don't want it to overwrite files in the current backup but to link to the old ones, and if there's anything different between my current files and the last backup to create a new one with only the changed files listed.

So far I have tried the following command.

rsync -argptcvn --link-dest= 'cat /media/backup/$USER/lastbackup.log'

My command program adds the last successful backup name to a file called lastbackup.log; what I want to do is to get --link-dest to read the contents of that file before creating the next backup folder

However unless I put the full file path into the --link-dest path it shows the message

--link-dest arg does not exist: 

I have also tried using redirection to take the contents of the file however that fails with the same message.

1 Answer

However unless i put the full file path into the --link-dest path it shows the message

--link-dest arg does not exist:

Thats actually good. The --link-dir option works, the path exists.

'cat /media/backup/$USER/lastbackup.log'

is the problem. The expression just isn't evaluated.

You might want to try

`cat /media/backup/$USER/lastbackup.log`

or

( cat /media/backup/$USER/lastbackup.log )
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like