{"id":277,"date":"2007-05-01T16:48:12","date_gmt":"2007-05-01T15:48:12","guid":{"rendered":"http:\/\/www.dotmana.com\/index.php\/?p=277"},"modified":"2007-05-01T16:52:42","modified_gmt":"2007-05-01T15:52:42","slug":"resume-scp","status":"publish","type":"post","link":"http:\/\/www.dotmana.com\/weblog\/2007\/05\/resume-scp\/","title":{"rendered":"Resume SCP"},"content":{"rendered":"<p>A very good article, very useful, thanx to its author !<\/p>\n<blockquote><p>I often use the UNIX command line tool scp (secure copy) to copy a file to a remote server. However, scp has one major drawback: It doesn\u2019t support resuming a transfer. So whenever I\u2019m transferring a file and something comes up which interrupts my transfer\u2013which is bound to happen\u2013I\u2019m cursing away at scp. The solution? Use rsync. It is overkill for most things I do, but when a transfer is interrupted, it is handy. Now, on to the doing.<\/p>\n<p>I want to transfer the file \u201cmyFile\u201d to the server \u201cremoteMachine\u201d, which I do with scp:<br \/>\n<code>scp myFile remoteMachine:dirToPutIn\/<\/code><br \/>\n(You should know this already if you\u2019re reading this in the first place.)<\/p>\n<p>(Muzak while the transfer is in progress; a loud wail and the sound of hair being torn out by its roots as the transfer comes to a grinding halt.)<\/p>\n<p>Time to resume the file with rsync, which I do thusly:<br \/>\n<code>rsync --partial --progress myFile remoteMachine:dirToPutIn\/<\/code><br \/>\nThe \u201c\u2013partial\u201d argument is what does the trick. I added \u201c\u2013progress\u201d because I like to see how the transfer is going; rsync understandably doesn\u2019t show this by default as it is mostly used for purposes which don\u2019t require live progress reporting (e.g. scheduled backups).<\/p>\n<p>Because I know I\u2019ll have this problem again at some point, I have created an alias in my shell\u2019s (zsh) configuration file (~\/.zshrc):<br \/>\n<code>alias scpresume=\"rsync --partial --progress\"<\/code><br \/>\nI know that rsync and scp are not necessarily related, but the name \u201cscpresume\u201d reflects the purpose of the task I wish to do. And getting it done is what matters the most after all.<\/p>\n<p style=\"border: 1px solid #333333; padding: 3px\"><span style=\"font-weight: bold\">Update:<\/span><br \/>\nJan pointed out in a comment that rsync communication is not secure by default, and that you should use tunneling to achieve secure communication. Andi provides the solution which is quite simple: Use <code>--rsh=ssh<\/code> (use ssh as the <strong>r<\/strong>emote <strong>sh<\/strong>ell). Thus, our alias from before would look like this:   <code>alias scpresume=\"rsync --partial --progress --rsh=ssh\"<\/code><\/p><\/blockquote>\n<p><a target=\"_blank\" href=\"http:\/\/joen.dk\/wordpress\/?p=34\">source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A very good article, very useful, thanx to its author ! I often use the UNIX command line tool scp (secure copy) to copy a file to a remote server. However, scp has one major drawback: It doesn\u2019t support resuming &hellip; <a href=\"http:\/\/www.dotmana.com\/weblog\/2007\/05\/resume-scp\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-277","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"_links":{"self":[{"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts\/277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":0,"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dotmana.com\/weblog\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}