Sponsored Content
Top Forums Shell Programming and Scripting Using rsync --link-dest pointing to a remote server Post 302824807 by Orionizer on Friday 21st of June 2013 02:52:16 PM
Old 06-21-2013
Using rsync --link-dest pointing to a remote server

Ok, I'm trying to figure out how to reference a remote file using the rsync --link-dest parameter.

Here is the code I have so far:

Code:
#
# FILESERVER INCREMENTAL BACKUP SCRIPT
#

# Remove previous log file

rm /usr/local/bin/rsync-incremental.log

# Set daily variables

DAY0=`date -I`
DAY1=`date -I -d "1 day ago"`
DAY6=`date -I -d "2 days ago"`
DAY7=`date -I -d "3 days ago"`
DAY8=`date -I -d "4 days ago"`

# Set rsync variables

SRC="/usr/smbshares"
TRG="root@synology1:/volume1/Fileserver/$DAY0"
LNK="root@synology1:/volume1/Fileserver/$DAY1"
OPT="-avhz -e ssh --log-file=/usr/local/bin/rsync-incremental.log --delete --link-dest=$LNK"

# Remove old backups

ssh root@synology1 "if [[ -d /volume1/Fileserver/$DAY6 ]]; then nohup rm -rf "/volume1/Fileserver/$DAY6"; fi"

ssh root@synology1 "if [[ -d /volume1/Fileserver/$DAY7 ]]; then nohup rm -rf "/volume1/Fileserver/$DAY7"; fi"

ssh root@synology1 "if [[ -d /volume1/Fileserver/$DAY8 ]]; then nohup rm -rf "/volume1/Fileserver/$DAY8"; fi"

# Perform the rsync

rsync $OPT $SRC $TRG

Everything is working now except the --link-dest parameter. I get the following error at the beginning of execution:

--link-dest arg does not exist: root@synology1:/volume1/Fileserver/2013-06-20

What's funny is the rsync has no issue using the same syntax for the target folder of the command...

Anyone know how to reference the remote file for this?

Thanks!

---------- Post updated at 01:52 PM ---------- Previous update was at 01:31 PM ----------

If anyone is wondering, I'm trying to accomplish backing up a SLES Samba server to a remote Synology NAS. I want to keep 5 days worth of backups on the NAS, but only the original or changed files. Not backing up ALL files all five days.

If a backup folder exists that is 6, 7 or 8 days old, I want to remove it to keep files from accumulating on the NAS over time.

I know the $DAY6, etc. variables are wrong as I changed them for testing purposes.

So that's what I'm trying to accomplish. If you can think of any better way to accomplish this, I'd be glad to give that a shot as well, but from what I've read it seems rsync is pretty reliable and quick.

As it's working right now, I am getting the 5 days worth of backups, but it's copying every file every time as the --link-dest isn't working.
 

10 More Discussions You Might Find Interesting

1. Solaris

creating link for a file of remote server

Hi, I use to access a file on remote server. Can I create a link for this file present on remote server on my local server, if yes then please let me know. Thanx in advance. (7 Replies)
Discussion started by: sanjay1979
7 Replies

2. Shell Programming and Scripting

How to write a shell script for rsync to remote server?

Hello, Can you help me to write a shell script for rsync a folder from my server to remote server ? i do this in ssh by this command : rsync -avz -e ssh /copy/me/ login@serverip:/where/to i want have a shell script that do this command. and you know that this command ask remote... (0 Replies)
Discussion started by: Desperados
0 Replies

3. UNIX for Dummies Questions & Answers

rsync with --link-dest doesn't create hard links

I have been experimenting with rsync as a scriptable backup option, reading various example and tips pages, including Time Machine for every Unix out there - IMHO That page seems to describe the exact behavior I want: The ability to make a "full backup" snapshot regularly, but with rsync... (0 Replies)
Discussion started by: fitzwilliam
0 Replies

4. UNIX for Dummies Questions & Answers

To know the server which the production is pointing to?

Hi, How to know which server(Application or webserver) the production link or url is pointing to? Is there any command to get the server IP address? Thanks in advance. (3 Replies)
Discussion started by: venkatesht
3 Replies

5. AIX

How to create a sym link pointing a changing name.

Hello A new file is created every day with the date appended to the end of a name. We are using Autosys to run jobs which watches for the file and runs jobs. But Autosys does not have the capability to figure out the current date. I tried creating a symlink like this ln -s... (1 Reply)
Discussion started by: vra5107
1 Replies

6. UNIX for Advanced & Expert Users

Using remote rsync, but copy locally?

I'm looking to use rsync to compare remote files and to copy the diff to a local directory, rather than transfer over the net. The net connection is not fast enough to transfer these files (~1.8TB) and I'd like to sneakernet them instead. Possible? (4 Replies)
Discussion started by: dfbills
4 Replies

7. Solaris

rsync - remote connection error

Hi , We have installed rsync in two Solaris boxes, when we try to sync files from one machine to another.. it is giving the following error. ld.so.1: rsync: fatal: libiconv.so.2: open failed: No such file or directory rsync: connection unexpectedly closed (0 bytes received so far) rsync... (1 Reply)
Discussion started by: MVEERA
1 Replies

8. UNIX for Dummies Questions & Answers

Help with rsync using link-dest

Hi, I'm trying to keep backups of my home directory (i.e. back it up every day or so) using rsync with link-dest. This is how I do it, rsync -avh --delete --link-dest=/media/disk/oldbackup/ /home/user/ /media/disk/newbackup rm -f /media/disk/oldbackup ln -s newbackup... (1 Reply)
Discussion started by: lost.identity
1 Replies

9. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

10. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies
slack.conf(5)							File Formats Manual						     slack.conf(5)

NAME
slack.conf - configuration file for slack DESCRIPTION
The file /etc/slack.conf contains configuration information for slack(8) and its backends. It should contain one keyword-value pair per line, separated by an '=' sign. Keywords must consist solely of capital letters and underscores. Values may take any appropriate format, but must not begin with a space. Comments start with '#', and all text from the '#' to the end of a line is ignored. Trailing whitespace on lines is ignored. Empty lines or lines consisting of only whitespace and comments are ignored. Valid keywords are: SOURCE The master source for slack roles. It can be in one of four forms: o /path/to/dir Use a local directory. o somehost:/path/to/dir Use given directory on a remote host via rsync over SSH. o rsync://somehost/module Use module on a remote rsyncd server (directly over the network). o somehost::module Use the rsync daemon protocol over SSH to the given host. See "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" in rsync(1) All forms of SOURCE are passed directly to rsync, so you can do things like add "user@" before the host on any remote forms. For more about what rsync can do, see its manual page, of course. For the last form, however, we do a little magic. rsync treats the last two forms equivalently, so we overload the last form by automatically passing "-e ssh" to rsync when we see it. This hack lets us tell slack to use this nice feature of rsync just using the SOURCE config option. ROOT The root filesystem into which to install slack roles. Usually '/'. ROLE_LIST The location of the role list, which lists the roles to be installed by default on each host. This can be a path relative to the source, or can be an entirely separate location if it starts with a slash or a hostname (option- ally preceeded by user@). CACHE A local cache directory, used as a local mirror of the SOURCE. STAGE A local staging directory, used as an intermediate stage when installing files. BACKUP_DIR A directory in which to keep dated backups for rollbacks. EXAMPLE
A typical file might look like this: # slack.conf configuration file SOURCE=slack-master:/slack # source is on a remote # host named "slack-master" ROLE_LIST=slack-master:/roles.conf ROOT=/ CACHE=/var/cache/slack STAGE=/var/lib/slack/stage BACKUP_DIR=/var/lib/slack/backups FILES
/etc/slack.conf SEE ALSO
slack(8), rsync(1) File formats 2005-05-23 slack.conf(5)
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy