{"id":775,"date":"2013-04-11T10:42:16","date_gmt":"2013-04-11T08:42:16","guid":{"rendered":"http:\/\/clark.tipistrani.it\/?p=775"},"modified":"2013-04-11T10:47:31","modified_gmt":"2013-04-11T08:47:31","slug":"mirroring-uno-script-per-fare-un-backup-giornaliero","status":"publish","type":"post","link":"http:\/\/clark.tipistrani.it\/?p=775","title":{"rendered":"mirroring  uno script per fare un backup giornaliero"},"content":{"rendered":"<p>Questo\u00a0 script provvede giornalmente a creare su un disco la copia di una parte dei dati del cluster, vengono salvate solo le directory condivise.<\/p>\n<p>#!\/bin\/sh -x<br \/>\nPATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin<br \/>\n#<br \/>\n# DESCRIZIONE<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Esecuzione automatica della sincronia di alcune aree.<br \/>\n#<br \/>\n# AUTORE<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Clark \u00a0 &#8211;\u00a0\u00a0 ottobre\u00a0 2009<br \/>\n#<br \/>\n# OSSERVAZIONI<\/p>\n<p>#!\/bin\/sh<\/p>\n<p>SYNCRO=&#8221;&#8221;<br \/>\n#SYNCRO=&#8221;-n&#8221;<br \/>\nMAXTEMPO=120<br \/>\nMAXBANDA=10240<\/p>\n<p>MACHINE=`uname -n`<br \/>\nif [ &#8220;$MACHINE&#8221; = &#8220;sangiusto&#8221; ] ; then<br \/>\nMACHINE2=&#8221;sanmarco&#8221;<br \/>\nelse<br \/>\nMACHINE2=&#8221;sangiusto&#8221;<br \/>\nfi<\/p>\n<p>ELENCO=&#8221;boot var usr bin sbin etc lib emul root&#8221;<\/p>\n<p>for i in $ELENCO ; do<br \/>\necho<br \/>\necho &#8220;MIRROR $i&#8221;<br \/>\nif [ -d \/mirror\/lost+found -a -d \/mirror\/sistema\/$i ] ; then<br \/>\nrsync $SYNCRO -avzH &#8211;delete &#8211;numeric-ids &#8211;stats \/$i\/ \/mirror\/sistema\/$i<br \/>\nelse<br \/>\necho &#8220;mirror myfirm $i error&#8221; | mail -s &#8220;ERROR:mirror myfirm&#8221; sysadmin@myfirm.com<br \/>\nfi<br \/>\n### creo copia dei files critical mission e delle conf.<\/p>\n<p>done<\/p>\n<p>cluster=`\/sbin\/ifconfig | grep 192.168.2.10`<\/p>\n<p>[ &#8220;$cluster&#8221; = &#8220;&#8221; ] &amp;&amp; exit<br \/>\n[ &#8220;$MACHINE2&#8221; = &#8220;sangiusto&#8221; ] &amp;&amp; exit<\/p>\n<p>ELENCO2=&#8221;etcvar home2 home3&#8243;<br \/>\nGIORNO=`date +%u`<\/p>\n<p>for i in $ELENCO2 ; do<br \/>\necho<br \/>\necho &#8220;MIRROR $i $GIORNO&#8221;<br \/>\nif [ -d \/mirror\/$GIORNO ] ; then<br \/>\nrsync $SYNCRO -avzH &#8211;delete &#8211;numeric-ids &#8211;exclude &#8216;*\/ntprofiles\/*&#8217; &#8211;stats \/$i\/ \/mirror\/$GIORNO\/$i<br \/>\nelse<br \/>\necho &#8220;mirror myfirm $i $GIORNO error&#8221; | mail -s &#8220;ERROR:mirror myfirm&#8221; sysadmin@myfirm.com<br \/>\nfi<br \/>\ndone<br \/>\n### creo copia delel directory in esame escludendo la directory dei roaming profiles<\/p>\n<p>for i in $ELENCO2 ; do<br \/>\necho<br \/>\necho &#8220;MIRROR cluster $i $GIORNO&#8221;<br \/>\nif [ -d \/mirror\/$GIORNO ] ; then<br \/>\nrsync $SYNCRO -avzH &#8211;delete &#8211;numeric-ids &#8211;timeout=$MAXTEMPO &#8211;stats &#8211;bwlimit=$MAXBANDA \\<br \/>\n\/mirror\/$GIORNO\/$i\/ root@${MACHINE2}:\/mirror\/$GIORNO\/$i<br \/>\nelse<br \/>\necho &#8220;mirror cluster myfirm $i $GIORNO error&#8221; | mail -s &#8220;ERROR:mirror myfirm&#8221; sysadmin@myfirm.com<br \/>\nfi<br \/>\ndone<br \/>\n### creo la copia del backup sul disco omologo della macchina slave<\/p>\n<p>exit<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Questo\u00a0 script provvede giornalmente a creare su un disco la copia di una parte dei dati del cluster, vengono salvate solo le directory condivise. #!\/bin\/sh -x PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin # # DESCRIZIONE #\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Esecuzione automatica della sincronia di alcune aree. # # AUTORE #\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Clark \u00a0 &#8211;\u00a0\u00a0 ottobre\u00a0 2009 # # OSSERVAZIONI #!\/bin\/sh SYNCRO=&#8221;&#8221; #SYNCRO=&#8221;-n&#8221; MAXTEMPO=120 MAXBANDA=10240 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9,7,6],"tags":[18,22,20,21],"class_list":["post-775","post","type-post","status-publish","format-standard","hentry","category-linux","category-script","category-sistemi-operativi","category-work","tag-backup","tag-copia","tag-restore","tag-rsync"],"_links":{"self":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts\/775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=775"}],"version-history":[{"count":4,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts\/775\/revisions"}],"predecessor-version":[{"id":779,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=\/wp\/v2\/posts\/775\/revisions\/779"}],"wp:attachment":[{"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=775"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/clark.tipistrani.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}