Rsync is syncing $HOME instead of the provided directory
Clash Royale CLAN TAG#URR8PPP
Any idea why this rsync command could be syncing contents of a home directory instead of the actual path provided?
echo "$REMOTE_STORAGE_PATH: $REMOTE_STORAGE_PATH/files/"
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/" "$FILES_PATH"
REMOTE_STORAGE_PATH
have a correct value (/var/storage
), files I want to sync are in /var/storage/files
. Yet, what is being synced is a content of the home directory of my REMOTE_USER
. Like... what even can cause this? Any ideas?
REMOTE_USER
is the owner of the REMOTE_STORAGE_PATH
directory, and files
subdirectory.
Actually, the most baffling part is that in the same script, almost just before that, I have almost exactly the same line of code:
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete --progress $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/database.sql" "$DUMPS_PATH/$TARGET.sql"
And that syncs correctly. Like... what?
bash rsync
add a comment |
Any idea why this rsync command could be syncing contents of a home directory instead of the actual path provided?
echo "$REMOTE_STORAGE_PATH: $REMOTE_STORAGE_PATH/files/"
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/" "$FILES_PATH"
REMOTE_STORAGE_PATH
have a correct value (/var/storage
), files I want to sync are in /var/storage/files
. Yet, what is being synced is a content of the home directory of my REMOTE_USER
. Like... what even can cause this? Any ideas?
REMOTE_USER
is the owner of the REMOTE_STORAGE_PATH
directory, and files
subdirectory.
Actually, the most baffling part is that in the same script, almost just before that, I have almost exactly the same line of code:
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete --progress $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/database.sql" "$DUMPS_PATH/$TARGET.sql"
And that syncs correctly. Like... what?
bash rsync
Did you run the script withbash -x
to see what the actual command used looks like?
– Kusalananda
Feb 22 at 13:49
It looks fine:+ rsync -zqr -e 'ssh -p 20022' --delete --progress luken@xxx:/var/storage/files/ /home/luken/srv/http/projects/2014/xxx/scripts/../env/dev/php/resources/files
(just censored few bits). And it still synced$HOME
... (I added--progress
as a desperate attempt to make it the same as the previous one, to see if it will change anything, but it shouldn't matter).
– Łukasz Zaroda
Feb 22 at 14:01
Could you just also have a look at the actual files under/var/storage/files
on the remote host as a sanity check, just to see whether the files there are the files that you expect to be there?
– Kusalananda
Feb 22 at 14:04
OMG, I cannot believe, haha, you were right, although I have no idea how the content of files ended up as it ended. Well, you can post it as an answer I guess, that's the peak of my stupidity this year I guess.
– Łukasz Zaroda
Feb 22 at 14:08
add a comment |
Any idea why this rsync command could be syncing contents of a home directory instead of the actual path provided?
echo "$REMOTE_STORAGE_PATH: $REMOTE_STORAGE_PATH/files/"
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/" "$FILES_PATH"
REMOTE_STORAGE_PATH
have a correct value (/var/storage
), files I want to sync are in /var/storage/files
. Yet, what is being synced is a content of the home directory of my REMOTE_USER
. Like... what even can cause this? Any ideas?
REMOTE_USER
is the owner of the REMOTE_STORAGE_PATH
directory, and files
subdirectory.
Actually, the most baffling part is that in the same script, almost just before that, I have almost exactly the same line of code:
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete --progress $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/database.sql" "$DUMPS_PATH/$TARGET.sql"
And that syncs correctly. Like... what?
bash rsync
Any idea why this rsync command could be syncing contents of a home directory instead of the actual path provided?
echo "$REMOTE_STORAGE_PATH: $REMOTE_STORAGE_PATH/files/"
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/" "$FILES_PATH"
REMOTE_STORAGE_PATH
have a correct value (/var/storage
), files I want to sync are in /var/storage/files
. Yet, what is being synced is a content of the home directory of my REMOTE_USER
. Like... what even can cause this? Any ideas?
REMOTE_USER
is the owner of the REMOTE_STORAGE_PATH
directory, and files
subdirectory.
Actually, the most baffling part is that in the same script, almost just before that, I have almost exactly the same line of code:
rsync -zqr -e "ssh -p $REMOTE_PORT" --delete --progress $REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/database.sql" "$DUMPS_PATH/$TARGET.sql"
And that syncs correctly. Like... what?
bash rsync
bash rsync
edited Feb 22 at 13:42
Łukasz Zaroda
asked Feb 22 at 13:31
Łukasz ZarodaŁukasz Zaroda
1,1572913
1,1572913
Did you run the script withbash -x
to see what the actual command used looks like?
– Kusalananda
Feb 22 at 13:49
It looks fine:+ rsync -zqr -e 'ssh -p 20022' --delete --progress luken@xxx:/var/storage/files/ /home/luken/srv/http/projects/2014/xxx/scripts/../env/dev/php/resources/files
(just censored few bits). And it still synced$HOME
... (I added--progress
as a desperate attempt to make it the same as the previous one, to see if it will change anything, but it shouldn't matter).
– Łukasz Zaroda
Feb 22 at 14:01
Could you just also have a look at the actual files under/var/storage/files
on the remote host as a sanity check, just to see whether the files there are the files that you expect to be there?
– Kusalananda
Feb 22 at 14:04
OMG, I cannot believe, haha, you were right, although I have no idea how the content of files ended up as it ended. Well, you can post it as an answer I guess, that's the peak of my stupidity this year I guess.
– Łukasz Zaroda
Feb 22 at 14:08
add a comment |
Did you run the script withbash -x
to see what the actual command used looks like?
– Kusalananda
Feb 22 at 13:49
It looks fine:+ rsync -zqr -e 'ssh -p 20022' --delete --progress luken@xxx:/var/storage/files/ /home/luken/srv/http/projects/2014/xxx/scripts/../env/dev/php/resources/files
(just censored few bits). And it still synced$HOME
... (I added--progress
as a desperate attempt to make it the same as the previous one, to see if it will change anything, but it shouldn't matter).
– Łukasz Zaroda
Feb 22 at 14:01
Could you just also have a look at the actual files under/var/storage/files
on the remote host as a sanity check, just to see whether the files there are the files that you expect to be there?
– Kusalananda
Feb 22 at 14:04
OMG, I cannot believe, haha, you were right, although I have no idea how the content of files ended up as it ended. Well, you can post it as an answer I guess, that's the peak of my stupidity this year I guess.
– Łukasz Zaroda
Feb 22 at 14:08
Did you run the script with
bash -x
to see what the actual command used looks like?– Kusalananda
Feb 22 at 13:49
Did you run the script with
bash -x
to see what the actual command used looks like?– Kusalananda
Feb 22 at 13:49
It looks fine:
+ rsync -zqr -e 'ssh -p 20022' --delete --progress luken@xxx:/var/storage/files/ /home/luken/srv/http/projects/2014/xxx/scripts/../env/dev/php/resources/files
(just censored few bits). And it still synced $HOME
... (I added --progress
as a desperate attempt to make it the same as the previous one, to see if it will change anything, but it shouldn't matter).– Łukasz Zaroda
Feb 22 at 14:01
It looks fine:
+ rsync -zqr -e 'ssh -p 20022' --delete --progress luken@xxx:/var/storage/files/ /home/luken/srv/http/projects/2014/xxx/scripts/../env/dev/php/resources/files
(just censored few bits). And it still synced $HOME
... (I added --progress
as a desperate attempt to make it the same as the previous one, to see if it will change anything, but it shouldn't matter).– Łukasz Zaroda
Feb 22 at 14:01
Could you just also have a look at the actual files under
/var/storage/files
on the remote host as a sanity check, just to see whether the files there are the files that you expect to be there?– Kusalananda
Feb 22 at 14:04
Could you just also have a look at the actual files under
/var/storage/files
on the remote host as a sanity check, just to see whether the files there are the files that you expect to be there?– Kusalananda
Feb 22 at 14:04
OMG, I cannot believe, haha, you were right, although I have no idea how the content of files ended up as it ended. Well, you can post it as an answer I guess, that's the peak of my stupidity this year I guess.
– Łukasz Zaroda
Feb 22 at 14:08
OMG, I cannot believe, haha, you were right, although I have no idea how the content of files ended up as it ended. Well, you can post it as an answer I guess, that's the peak of my stupidity this year I guess.
– Łukasz Zaroda
Feb 22 at 14:08
add a comment |
1 Answer
1
active
oldest
votes
The issue was resolved in comments.
There was no issue whatsoever with the rsync
command. Rather, the remote directory contained files not actually expected to be there.
A short note about the command though,
rsync -zqr
-e "ssh -p $REMOTE_PORT"
--delete
$REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
This contains a number of unquoted variable expansions. For safety, I would write this as
rsync -zqr
-e "ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
Note that using $variable
is exactly the same as $variable
unless the immediately following character is a valid character in a variable name, as in $variablex
.
In a script, I would additionally always use the long options, if possible, for documentation purposes. But that's my personal opinion. And I would probably use --archive
rather than --recursive
, to also sync file metadata (timestamps etc.)
rsync --compress --quiet --archive
--rsh="ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502303%2frsync-is-syncing-home-instead-of-the-provided-directory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The issue was resolved in comments.
There was no issue whatsoever with the rsync
command. Rather, the remote directory contained files not actually expected to be there.
A short note about the command though,
rsync -zqr
-e "ssh -p $REMOTE_PORT"
--delete
$REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
This contains a number of unquoted variable expansions. For safety, I would write this as
rsync -zqr
-e "ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
Note that using $variable
is exactly the same as $variable
unless the immediately following character is a valid character in a variable name, as in $variablex
.
In a script, I would additionally always use the long options, if possible, for documentation purposes. But that's my personal opinion. And I would probably use --archive
rather than --recursive
, to also sync file metadata (timestamps etc.)
rsync --compress --quiet --archive
--rsh="ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
add a comment |
The issue was resolved in comments.
There was no issue whatsoever with the rsync
command. Rather, the remote directory contained files not actually expected to be there.
A short note about the command though,
rsync -zqr
-e "ssh -p $REMOTE_PORT"
--delete
$REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
This contains a number of unquoted variable expansions. For safety, I would write this as
rsync -zqr
-e "ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
Note that using $variable
is exactly the same as $variable
unless the immediately following character is a valid character in a variable name, as in $variablex
.
In a script, I would additionally always use the long options, if possible, for documentation purposes. But that's my personal opinion. And I would probably use --archive
rather than --recursive
, to also sync file metadata (timestamps etc.)
rsync --compress --quiet --archive
--rsh="ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
add a comment |
The issue was resolved in comments.
There was no issue whatsoever with the rsync
command. Rather, the remote directory contained files not actually expected to be there.
A short note about the command though,
rsync -zqr
-e "ssh -p $REMOTE_PORT"
--delete
$REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
This contains a number of unquoted variable expansions. For safety, I would write this as
rsync -zqr
-e "ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
Note that using $variable
is exactly the same as $variable
unless the immediately following character is a valid character in a variable name, as in $variablex
.
In a script, I would additionally always use the long options, if possible, for documentation purposes. But that's my personal opinion. And I would probably use --archive
rather than --recursive
, to also sync file metadata (timestamps etc.)
rsync --compress --quiet --archive
--rsh="ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
The issue was resolved in comments.
There was no issue whatsoever with the rsync
command. Rather, the remote directory contained files not actually expected to be there.
A short note about the command though,
rsync -zqr
-e "ssh -p $REMOTE_PORT"
--delete
$REMOTE_USER@$REMOTE_SERVER:"$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
This contains a number of unquoted variable expansions. For safety, I would write this as
rsync -zqr
-e "ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
Note that using $variable
is exactly the same as $variable
unless the immediately following character is a valid character in a variable name, as in $variablex
.
In a script, I would additionally always use the long options, if possible, for documentation purposes. But that's my personal opinion. And I would probably use --archive
rather than --recursive
, to also sync file metadata (timestamps etc.)
rsync --compress --quiet --archive
--rsh="ssh -p '$REMOTE_PORT'"
--delete
"$REMOTE_USER@$REMOTE_SERVER:$REMOTE_STORAGE_PATH/files/"
"$FILES_PATH"
edited Feb 22 at 14:20
answered Feb 22 at 14:09
KusalanandaKusalananda
136k17257426
136k17257426
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502303%2frsync-is-syncing-home-instead-of-the-provided-directory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you run the script with
bash -x
to see what the actual command used looks like?– Kusalananda
Feb 22 at 13:49
It looks fine:
+ rsync -zqr -e 'ssh -p 20022' --delete --progress luken@xxx:/var/storage/files/ /home/luken/srv/http/projects/2014/xxx/scripts/../env/dev/php/resources/files
(just censored few bits). And it still synced$HOME
... (I added--progress
as a desperate attempt to make it the same as the previous one, to see if it will change anything, but it shouldn't matter).– Łukasz Zaroda
Feb 22 at 14:01
Could you just also have a look at the actual files under
/var/storage/files
on the remote host as a sanity check, just to see whether the files there are the files that you expect to be there?– Kusalananda
Feb 22 at 14:04
OMG, I cannot believe, haha, you were right, although I have no idea how the content of files ended up as it ended. Well, you can post it as an answer I guess, that's the peak of my stupidity this year I guess.
– Łukasz Zaroda
Feb 22 at 14:08