snipt

Ctrl+h for KB shortcuts

Bash

backupfox.sh

#!/bin/sh
# source: http://blog.interlinked.org/tutorials/rsync_time_machine.html


DATA=`date "+%Y-%m-%dT%H:%M:%S"`
SOURCE=`find $HOME/.mozilla -iname "*.default"`
CURRENT=$HOME/ubuntuone/dotfiles/firefox/current

rsync -aP --link-dest=$CURRENT $SOURCE /home/sergio/ubuntuone/dotfiles/firefox/backup-$DATA

rm -f $CURRENT

ln -s backup-$DATA $CURRENT
https://snippets.siftie.com/embed/2f177ce20dcd7913e49559e658314a49/
/raw/2f177ce20dcd7913e49559e658314a49/
2f177ce20dcd7913e49559e658314a49
bash
Bash
14
2019-03-22T22:42:52
True
False
False
/api/public/snipt/46416/
backupfoxsh
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a> <a href="#L-12">12</a> <a href="#L-13">13</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="ch">#!/bin/sh</span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># source: http://blog.interlinked.org/tutorials/rsync_time_machine.html</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="nv">DATA</span><span class="o">=</span><span class="sb">`</span>date <span class="s2">&quot;+%Y-%m-%dT%H:%M:%S&quot;</span><span class="sb">`</span> </span><span id="L-6"><a name="L-6"></a><span class="nv">SOURCE</span><span class="o">=</span><span class="sb">`</span>find <span class="nv">$HOME</span>/.mozilla -iname <span class="s2">&quot;*.default&quot;</span><span class="sb">`</span> </span><span id="L-7"><a name="L-7"></a><span class="nv">CURRENT</span><span class="o">=</span><span class="nv">$HOME</span>/ubuntuone/dotfiles/firefox/current </span><span id="L-8"><a name="L-8"></a> </span><span id="L-9"><a name="L-9"></a>rsync -aP --link-dest<span class="o">=</span><span class="nv">$CURRENT</span> <span class="nv">$SOURCE</span> /home/sergio/ubuntuone/dotfiles/firefox/backup-<span class="nv">$DATA</span> </span><span id="L-10"><a name="L-10"></a> </span><span id="L-11"><a name="L-11"></a>rm -f <span class="nv">$CURRENT</span> </span><span id="L-12"><a name="L-12"></a> </span><span id="L-13"><a name="L-13"></a>ln -s backup-<span class="nv">$DATA</span> <span class="nv">$CURRENT</span> </span></pre></div> </td></tr></table>
backup, bash, firefox, rsync