{"id":119,"date":"2013-08-21T23:45:00","date_gmt":"2013-08-21T23:45:00","guid":{"rendered":"https:\/\/moondog.org\/backup-script-using-rsync\/"},"modified":"2020-04-04T13:51:21","modified_gmt":"2020-04-04T20:51:21","slug":"backup-script-using-rsync","status":"publish","type":"post","link":"https:\/\/moondog.org\/?p=119","title":{"rendered":"Backup script using rsync"},"content":{"rendered":"<p>Here&#8217;s a cute little backup script I wrote. Just a little smarts to suit my particular situation. But I did learn how to prompt for a parameter and do a case statement. The rsync command is a very powerful backup tool. On this particular backup drive (Lacie) I have two sets of backups&#8230; (\/backup1\/ and \/backup2\/). This script prompts me for which one I want to use and does the right thing. I&#8217;m also using an exclude list in the form of a txt file to omit browser caches and the like.<\/p>\n<blockquote><p><span style=\"background-color: #cfe2f3; font-family: Courier New, Courier, monospace; font-size: small;\"><span style=\"background-color: #666666;\"><span style=\"color: #eeeeee;\">#!\/bin\/bash<br \/>read -p &#8220;Backup number (1\/2)?&#8221; choice<br \/>case &#8220;$choice&#8221; in<br \/>1 ) echo &#8220;1&#8221;;;<br \/>2 ) echo &#8220;2&#8221;;;<br \/>* ) echo &#8220;Failure to communicate, try again.&#8221;;exit 1;;<br \/>esac<br \/>path=&#8221;\/home\/&#8221;<br \/>pathfrom=&#8221;$path.&#8221;<br \/>pathto=&#8221;\/media\/Lacie\/backup$choice$path.&#8221;<br \/>rsync -avAX &#8211;delete &#8211;exclude-from &#8216;\/usr\/local\/bin\/backup-exclude.txt&#8217; &#8220;$pathfrom&#8221; &#8220;$pathto&#8221;<\/span><\/span><\/span><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a cute little backup script I wrote. Just a little smarts to suit my particular situation. But I did learn how to prompt for a parameter and do a case statement. The rsync command is a very powerful backup tool. On this particular backup drive (Lacie) I have two sets of backups&#8230; (\/backup1\/ and &hellip; <a href=\"https:\/\/moondog.org\/?p=119\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Backup script using rsync&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-119","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-technology"],"_links":{"self":[{"href":"https:\/\/moondog.org\/index.php?rest_route=\/wp\/v2\/posts\/119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/moondog.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/moondog.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/moondog.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/moondog.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=119"}],"version-history":[{"count":1,"href":"https:\/\/moondog.org\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":249,"href":"https:\/\/moondog.org\/index.php?rest_route=\/wp\/v2\/posts\/119\/revisions\/249"}],"wp:attachment":[{"href":"https:\/\/moondog.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/moondog.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/moondog.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}