TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A backup rotation filter for the Unix shell

97 点作者 closeneough大约 5 年前

12 条评论

adrianmonk大约 5 年前
&gt; <i>To list backups that will should be kept use the --invert option.</i><p>May I suggest changing the name to something more direct? Calling it &quot;--invert&quot; means the user must think through what the default sense of the test is, then negate that in their mind. Not exactly a tough mental task, but people do make careless errors.<p>Perhaps something like &quot;--list=keep&quot; and &quot;--list=discard&quot; (with the default being &quot;discard&quot;).<p>Also, typos:<p>&quot;will make prunef to keep&quot; --&gt; &quot;will make prunef keep&quot;<p>&quot;list backups that will should be&quot; --&gt; &quot;list backups that should be&quot;
评论 #22455423 未加载
yjftsjthsd-h大约 5 年前
Handy looking tool:)<p>Meta: I&#x27;m excited to see sr.ht starting to pop up in the wild like this:) I hope this is part of it starting to take off.
评论 #22452322 未加载
评论 #22452084 未加载
speedgoose大约 5 年前
I use rotate-backups with temporary files and your script is an interesting alternative.<p><a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;rotate-backups&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;rotate-backups&#x2F;</a>
inshadows大约 5 年前
FYI the interface format seems to be inspired by borg-prune[1].<p>[1] <a href="https:&#x2F;&#x2F;borgbackup.readthedocs.io&#x2F;en&#x2F;stable&#x2F;usage&#x2F;prune.html" rel="nofollow">https:&#x2F;&#x2F;borgbackup.readthedocs.io&#x2F;en&#x2F;stable&#x2F;usage&#x2F;prune.html</a>
评论 #22455375 未加载
usr1106大约 5 年前
The original title reads &quot;... for your Unix shell&quot;, suggesting that the code is portable to many shells. I have not verified that claim.<p>&quot;... for the Unix shell&quot; makes little sense. When I used Unix my shell was csh, later tcsh. Nowadays my shell is bash in most cases and dash in some more limited environments. Either case, &quot;the Unix shell&quot; does not exist.
epx大约 5 年前
Did something similar but employed a Fibonacci sequence, using the hour as the unit (but could be a minute, or a second), to groom a collection of snapshots maintaining a sensible timeline: <a href="https:&#x2F;&#x2F;epxx.co&#x2F;logbook&#x2F;entries&#x2F;fibo_en.html" rel="nofollow">https:&#x2F;&#x2F;epxx.co&#x2F;logbook&#x2F;entries&#x2F;fibo_en.html</a>
bArray大约 5 年前
If anybody else is using a similar method, I think it&#x27;s also good to encrypt the backups:<p><pre><code> tar -zcv &lt;SRC_BACKUP&gt; | gpg -c --batch --passphrase &lt;PASSWORD&gt; -o &lt;DEST_BACKUP&gt;.gz.gpg </code></pre> In my experience the encryption part doesn&#x27;t add any extra time on a modern machine, with the spinning disk being the slowest cog.
评论 #22453036 未加载
djsumdog大约 5 年前
This is awesome. I currently use duplicity for backups to BackBlaze, but my DB backups I just place a files and I&#x27;ve just been pruning old one&#x27;s manually for a while. Something like this, that lets me specify the file format, would be perfect!
评论 #22455513 未加载
ggm大约 5 年前
Could you leverage information in zfs snapshots metadata to drive things like this? The copy on write semantics inherent seem plausibly related.<p>(Zfs snaps make awesome backups too, but unlike tar are inherently tied to zfs)
FrancoisBosun大约 5 年前
Similar concept, in Ruby, acting as a filter in a pipeline, by me:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;francois&#x2F;surrender" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;francois&#x2F;surrender</a>
anonsivalley652大约 5 年前
PSA: Be sure to test every backup completely before succeeding a backup job, or it&#x27;s not a backup.
aquabeagle大约 5 年前
tarsnap desperately needs something like this included with it.
评论 #22455720 未加载
评论 #22455040 未加载
评论 #22452012 未加载