{"id":215,"date":"2016-05-03T14:25:51","date_gmt":"2016-05-03T12:25:51","guid":{"rendered":"https:\/\/wpethzprd.ethz.ch\/isgdmath\/?p=215"},"modified":"2023-05-17T10:41:12","modified_gmt":"2023-05-17T08:41:12","slug":"unison","status":"publish","type":"post","link":"https:\/\/blogs.ethz.ch\/isgdmath\/unison\/","title":{"rendered":"Syncronize your Files with Unison"},"content":{"rendered":"<p>See also the alternative software <a href=\"https:\/\/blogs.ethz.ch\/isgdmath\/freefilesync\/\">FreeFileSync<\/a>.<\/p>\n<p class=\"p\">Unison is a file-synchronization tool for Linux, Mac and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.<\/p>\n<p><!--more--><\/p>\n<p class=\"p\">For example,&nbsp;you can synchronize (in both directions) your working directory on your laptop with the working directory on the D-MATH file server.<\/p>\n<h4 class=\"heading\">What you need is following&#8230;<\/h4>\n<ul class=\"square\">\n<li>your ssh key<\/li>\n<li>unison<\/li>\n<\/ul>\n<h4 class=\"heading\">SSH Keys<\/h4>\n<p class=\"p\">Open a Terminal (Mac: Applications &gt; Utilities &gt; Terminal) and enter the following commands:<\/p>\n<pre class=\"pre\">mv ~\/.ssh ~\/.ssh-old\nscp -pr &lt;username&gt;@sftpmath.math.ethz.ch:home\/.ssh ~\/.\n<\/pre>\n<h4>For Mac OS X<\/h4>\n<p>Please use <a href=\"https:\/\/blogs.ethz.ch\/isgdmath\/freefilesync\/\">FreeFileSync<\/a>&nbsp;instead.<\/p>\n<p class=\"p\">\n<h4 class=\"heading\">For Linux<\/h4>\n<p class=\"p\">Unison is usually already installed on our Linux systems and has to be configured as follow. Create a file in the directory <strong>~\/.unison\/<\/strong> called for instance MATH.prf with following content:<\/p>\n<pre class=\"p1\"><span class=\"s1\"># the roots to synchronise:\nroot = \/path\/to\/your\/home<\/span>\n<span class=\"s2\">root = <span class=\"s3\">ssh:\/\/username<\/span><span class=\"s3\">@sftpmath.math.ethz.ch\/home<\/span><\/span>\n<span class=\"s1\">\n# some useful options\ntimes = true<\/span>\n<span class=\"s1\">servercmd = unison-2.40\n<\/span>\n# Files to ignore\n<span class=\"s1\">ignore = Regex ^\\...*\nignore = Name VIDEO_TS\nignore = Name AUDIO_TS\nignore = Name *.mp4\nignore = Name *.mp3\nignore = Regex ^Downloads\nignore = Regex ^Music\nignore = Regex ^Pictures\nignore = Regex ^Public\nignore = Regex ^Videos\n<\/span><\/pre>\n<p class=\"p1\"><span class=\"s1\">In the first &#8220;root&#8221;-line enter the output of the following command:<\/span><\/p>\n<pre class=\"p1\">cd &amp;&amp; pwd<\/pre>\n<p class=\"p1\">In the second &#8220;root&#8221;-line replace &#8220;username&#8221; with you ETH username.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>See also the alternative software FreeFileSync. Unison is a file-synchronization tool for Linux, Mac and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica [&hellip;]<\/p>\n","protected":false},"author":43853,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[141877],"tags":[],"class_list":["post-215","post","type-post","status-publish","format-standard","hentry","category-backup"],"_links":{"self":[{"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/users\/43853"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":0,"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ethz.ch\/isgdmath\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}