Skip to content

Commit

Permalink
deploy: fa4bb52
Browse files Browse the repository at this point in the history
  • Loading branch information
winsphinx committed Nov 2, 2024
1 parent c6fc735 commit 9694ba6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ tar -caf <span class="nv">$TMP_BACKUP</span> --absolute-name
<span class="c1"># 使用 rsync 将备份同步到备份目录</span>
rsync -avzh --remove-source-files <span class="nv">$TMP_BACKUP</span> <span class="nv">$DEST_DIR</span>
<span class="c1"># 在备份目录上删除旧备份</span>
<span class="nb">cd</span> <span class="nv">$DEST_DIR</span> <span class="o">&&</span> <span class="o">(</span>ls -t <span class="p">|</span> tail -n +<span class="o">[</span>EXPIRED_DAYS+1<span class="o">]</span> <span class="p">|</span> xargs --no-run-if-empty rm -rvf<span class="o">)</span></code></pre></td></tr></table>
<span class="nb">cd</span> <span class="nv">$DEST_DIR</span> <span class="o">&&</span> <span class="o">(</span>ls -t <span class="p">|</span> tail -n +$<span class="o">[</span>EXPIRED_DAYS+1<span class="o">]</span> <span class="p">|</span> xargs --no-run-if-empty rm -rvf<span class="o">)</span></code></pre></td></tr></table>
</div>
</div>
<p>然后使用 <code>crontab -e</code> 增加定时计划: <br/></p>
Expand Down Expand Up @@ -926,7 +926,7 @@ tar -caf <span class="nv">$TMP_BACKUP</span> --absolute-name
<span class="c1"># 使用 rsync 将备份同步到远程服务器</span>
rsync -avzh --remove-source-files -e <span class="s2">"ssh -p </span><span class="nv">$SSH_PORT</span><span class="s2">"</span> <span class="nv">$TMP_BACKUP</span> root@<span class="nv">$REMOTE_HOST</span>:<span class="nv">$DEST_DIR</span>
<span class="c1"># 在远程服务器上删除旧备份</span>
ssh -p <span class="nv">$SSH_PORT</span> root@<span class="nv">$REMOTE_HOST</span> <span class="s2">"cd </span><span class="nv">$DEST_DIR</span><span class="s2"> && (ls -t | tail -n +[EXPIRED_DAYS+1] | xargs --no-run-if-empty rm -rvf)"</span></code></pre></td></tr></table>
ssh -p <span class="nv">$SSH_PORT</span> root@<span class="nv">$REMOTE_HOST</span> <span class="s2">"cd </span><span class="nv">$DEST_DIR</span><span class="s2"> && (ls -t | tail -n +</span>$<span class="s2">[EXPIRED_DAYS+1] | xargs --no-run-if-empty rm -rvf)"</span></code></pre></td></tr></table>
</div>
</div>
<p>【附注】如果不能使用密钥方式登录 ssh,则可以使用 <code>sshpass</code> 工具来传递密码。相应的命令改写成: <br/></p>
Expand Down
6 changes: 3 additions & 3 deletions post/home-networking/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
rsync -avzh --remove-source-files <span class=nv>$TMP_BACKUP</span> <span class=nv>$DEST_DIR</span>

<span class=c1># 在备份目录上删除旧备份</span>
<span class=nb>cd</span> <span class=nv>$DEST_DIR</span> <span class=o>&amp;&amp;</span> <span class=o>(</span>ls -t <span class=p>|</span> tail -n +<span class=o>[</span>EXPIRED_DAYS+1<span class=o>]</span> <span class=p>|</span> xargs --no-run-if-empty rm -rvf<span class=o>)</span></code></pre></td></tr></table></div></div><p>然后使用 <code>crontab -e</code> 增加定时计划:<br></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=lnt>1
<span class=nb>cd</span> <span class=nv>$DEST_DIR</span> <span class=o>&amp;&amp;</span> <span class=o>(</span>ls -t <span class=p>|</span> tail -n +$<span class=o>[</span>EXPIRED_DAYS+1<span class=o>]</span> <span class=p>|</span> xargs --no-run-if-empty rm -rvf<span class=o>)</span></code></pre></td></tr></table></div></div><p>然后使用 <code>crontab -e</code> 增加定时计划:<br></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=lnt>1
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=m>4</span> <span class=m>4</span> * * * /root/scripts/backup.sh <span class=c1># 每天4:04执行备份</span></code></pre></td></tr></table></div></div><h2 id=vps>VPS</h2><h3 id=创建-ssh-主机>创建 ssh 主机</h3><p>为了便于使用,在 ~~/.ssh~/config 中增加:<br></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code class=language-text data-lang=text><span class=lnt>1
</span><span class=lnt>2
</span><span class=lnt>3
Expand Down Expand Up @@ -426,14 +426,14 @@
rsync -avzh --remove-source-files -e <span class=s2>&#34;ssh -p </span><span class=nv>$SSH_PORT</span><span class=s2>&#34;</span> <span class=nv>$TMP_BACKUP</span> root@<span class=nv>$REMOTE_HOST</span>:<span class=nv>$DEST_DIR</span>

<span class=c1># 在远程服务器上删除旧备份</span>
ssh -p <span class=nv>$SSH_PORT</span> root@<span class=nv>$REMOTE_HOST</span> <span class=s2>&#34;cd </span><span class=nv>$DEST_DIR</span><span class=s2> &amp;&amp; (ls -t | tail -n +[EXPIRED_DAYS+1] | xargs --no-run-if-empty rm -rvf)&#34;</span></code></pre></td></tr></table></div></div><p>【附注】如果不能使用密钥方式登录 ssh,则可以使用 <code>sshpass</code> 工具来传递密码。相应的命令改写成:<br></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=lnt>1
ssh -p <span class=nv>$SSH_PORT</span> root@<span class=nv>$REMOTE_HOST</span> <span class=s2>&#34;cd </span><span class=nv>$DEST_DIR</span><span class=s2> &amp;&amp; (ls -t | tail -n +</span>$<span class=s2>[EXPIRED_DAYS+1] | xargs --no-run-if-empty rm -rvf)&#34;</span></code></pre></td></tr></table></div></div><p>【附注】如果不能使用密钥方式登录 ssh,则可以使用 <code>sshpass</code> 工具来传递密码。相应的命令改写成:<br></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=lnt>1
</span><span class=lnt>2
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell>sshpass -p <span class=s1>&#39;PASSWORD&#39;</span> rsync -avhP --remove-source-files -e <span class=s2>&#34;ssh -p </span><span class=nv>$SSH_PORT</span><span class=s2>&#34;</span> <span class=nv>$TMP_BACKUP</span> root@<span class=nv>$REMOTE_HOST</span>:<span class=nv>$DEST_DIR</span>
sshpass -p <span class=s1>&#39;PASSWORD&#39;</span> ssh -p <span class=nv>$SSH_PORT</span> root@<span class=nv>$REMOTE_HOST</span> <span class=s2>&#34;cd </span><span class=nv>$DEST_DIR</span><span class=s2> &amp;&amp; (ls -t | tail -n +8 | xargs --no-run-if-empty rm -rvf)&#34;</span></code></pre></td></tr></table></div></div><p>然后使用 <code>crontab -e</code> 增加定时计划:<br></p><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=lnt>1
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell><span class=m>4</span> <span class=m>4</span> * * * /root/scripts/backup.sh <span class=c1># 每天4:04执行备份</span></code></pre></td></tr></table></div></div></div><div class=post-copyright><p class=copyright-item><span class=item-title>文章作者</span>
<span class=item-content>winsphinx</span></p><p class=copyright-item><span class=item-title>上次更新</span>
<span class=item-content>2024-07-17
<a href=https://github.com/winsphinx/blog/commit/664b13708e376613086a316a9f3c4376fba98438 title="[原创] home">(664b137)</a><br>[原创] home</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<a href=https://github.com/winsphinx/blog/commit/6fbf450ef182e9b47faf18bc3e8b00e80eb82b4c title="[原创] home">(6fbf450)</a><br>[原创] home</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<span class=item-content><a rel="license noopener" href=https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh target=_blank><img alt="CC BY-NC-SA 4.0" style=border-width:0 src=https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png></a></span></p></div><footer class=post-footer><div class=post-tags><a href=https://blog.winsphinx.top/tags/linux/>linux</a>
<a href=https://blog.winsphinx.top/tags/network/>network</a></div><nav class=post-nav><a class=prev href=https://blog.winsphinx.top/post/xray/><i class=iconfont><svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M691.908486 949.511495l75.369571-89.491197c10.963703-12.998035 10.285251-32.864502-1.499144-44.378743L479.499795 515.267417l277.93508-310.326815c11.338233-12.190647 11.035334-32.285311-.638543-44.850487l-80.46666-86.564541c-11.680017-12.583596-30.356378-12.893658-41.662889-.716314L257.233596 494.235404c-11.332093 12.183484-11.041474 32.266891.657986 44.844348l80.46666 86.564541c1.772366 1.910513 3.706415 3.533476 5.750981 4.877077l306.620399 321.703933C662.505829 963.726242 680.945807 962.528973 691.908486 949.511495z"/></svg></i><span class="prev-text nav-default">xray</span>
<span class="prev-text nav-mobile">上一篇</span></a>
Expand Down
2 changes: 1 addition & 1 deletion post/sftp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</span></code></pre></td><td class=lntd><pre class=chroma><code class=language-shell data-lang=shell>systemctl restart sshd.service</code></pre></td></tr></table></div></div></div><div class=post-copyright><p class=copyright-item><span class=item-title>文章作者</span>
<span class=item-content>winsphinx</span></p><p class=copyright-item><span class=item-title>上次更新</span>
<span class=item-content>2024-09-11
<a href=https://github.com/winsphinx/blog/commit/8530d6a227e9be3e1ce2ab19db1a5b3e37a9d39a title="[原创] sftp">(8530d6a)</a><br>[原创] sftp</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<a href=https://github.com/winsphinx/blog/commit/fa4bb522a788447e10fb526604017ba87061195c title="[原创] sftp">(fa4bb52)</a><br>[原创] sftp</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<span class=item-content><a rel="license noopener" href=https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh target=_blank><img alt="CC BY-NC-SA 4.0" style=border-width:0 src=https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png></a></span></p></div><footer class=post-footer><div class=post-tags><a href=https://blog.winsphinx.top/tags/linux/>linux</a>
<a href=https://blog.winsphinx.top/tags/network/>network</a></div><nav class=post-nav><a class=next href=https://blog.winsphinx.top/post/the-black-friday/><span class="next-text nav-default">The Black Friday</span>
<span class="prev-text nav-mobile">下一篇</span>
Expand Down
2 changes: 1 addition & 1 deletion post/the-black-friday/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<span id=busuanzi_container_page_pv>| 阅读 <span id=busuanzi_value_page_pv></span></span></div></header><div class=post-toc id=post-toc><h2 class=post-toc-title>文章目录</h2><div class=post-toc-content></div></div><div class=post-content><p>写在 9 月 13 日,星期五。一个黑色的日子。<br></p><blockquote><p>我们生在中国, 我们葬在中国<br>我们所有的不幸,只有这么两个<br>躺在里面的,再也不必假装死了<br>留在外面的,还要继续假装活着<br></p></blockquote></div><div class=post-copyright><p class=copyright-item><span class=item-title>文章作者</span>
<span class=item-content>winsphinx</span></p><p class=copyright-item><span class=item-title>上次更新</span>
<span class=item-content>2024-09-13
<a href=https://github.com/winsphinx/blog/commit/fd2b01a4b7e942d6dff46b4cc4b7e8babcbfec8b title="[原创] retirement">(fd2b01a)</a><br>[原创] retirement</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<a href=https://github.com/winsphinx/blog/commit/965dcee71cddf7fde22cd16b8de77fb2811a8b41 title="[原创] retirement">(965dcee)</a><br>[原创] retirement</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<span class=item-content><a rel="license noopener" href=https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh target=_blank><img alt="CC BY-NC-SA 4.0" style=border-width:0 src=https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png></a></span></p></div><footer class=post-footer><div class=post-tags><a href=https://blog.winsphinx.top/tags/society/>society</a></div><nav class=post-nav><a class=prev href=https://blog.winsphinx.top/post/sftp/><i class=iconfont><svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M691.908486 949.511495l75.369571-89.491197c10.963703-12.998035 10.285251-32.864502-1.499144-44.378743L479.499795 515.267417l277.93508-310.326815c11.338233-12.190647 11.035334-32.285311-.638543-44.850487l-80.46666-86.564541c-11.680017-12.583596-30.356378-12.893658-41.662889-.716314L257.233596 494.235404c-11.332093 12.183484-11.041474 32.266891.657986 44.844348l80.46666 86.564541c1.772366 1.910513 3.706415 3.533476 5.750981 4.877077l306.620399 321.703933C662.505829 963.726242 680.945807 962.528973 691.908486 949.511495z"/></svg></i><span class="prev-text nav-default">sftp</span>
<span class="prev-text nav-mobile">上一篇</span></a>
<a class=next href=https://blog.winsphinx.top/post/xray/><span class="next-text nav-default">xray</span>
Expand Down
2 changes: 1 addition & 1 deletion post/xray/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
<span class=p>}</span></code></pre></td></tr></table></div></div><p>其中:<br></p><ul><li>(6) 客户端的侦听端口 socks 协议<br></li><li>(6&rsquo;) 客户端的侦听端口 http 协议,给某些不支持 socks 的服务用<br></li><li>(7) 服务器地址<br></li><li>(4&rsquo;) 长 ID,填与服务端对应的 &ldquo;Public key&rdquo; 的值<br></li></ul><div class=footnotes><hr><ol><li id=fn:1>该网站用于伪装,当认证不通过时,会显示该网站,让人以为服务器上运行的是一个网站。网站的选择有一定要求:首先进入待测网页,按下 F12 键,转到“安全性”选项卡,在“连接”下出现“TLS 1.3,X25519”字样即代表网页支持 TLSv1.3 协议、并且使用的是 x25519 证书;其次转到“控制台”选项卡,输入命令 <code>window.chrome.loadTimes()</code>​,查看 npnNegotiatedProtocol 的值是否为 h2,如果是的话就代表使用的是 H2 协议。<br><a class=footnote-return href=#fnref:1><sup>[return]</sup></a></li><li id=fn:2>serverName 列表,暂不支持 * 通配符,在 Chrome 里输入待测试的网址,按下 F12 键,转到“安全性”选项卡,刷新一下,查看“主要来源(安全)”,填证书中 SAN 的值,有多条就填多条。<br><a class=footnote-return href=#fnref:2><sup>[return]</sup></a></li></ol></div></div><div class=post-copyright><p class=copyright-item><span class=item-title>文章作者</span>
<span class=item-content>winsphinx</span></p><p class=copyright-item><span class=item-title>上次更新</span>
<span class=item-content>2024-08-12
<a href=https://github.com/winsphinx/blog/commit/0dfc13be5a2f3a3163cd750cae177d89bdc048df title="[原创] xray">(0dfc13b)</a><br>[原创] xray</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<a href=https://github.com/winsphinx/blog/commit/411829c41688bc5a12549727d5677a27a5077d7a title="[原创] xray">(411829c)</a><br>[原创] xray</span></p><p class=copyright-item><span class=item-title>许可协议</span>
<span class=item-content><a rel="license noopener" href=https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh target=_blank><img alt="CC BY-NC-SA 4.0" style=border-width:0 src=https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png></a></span></p></div><footer class=post-footer><div class=post-tags><a href=https://blog.winsphinx.top/tags/linux/>linux</a>
<a href=https://blog.winsphinx.top/tags/network/>network</a></div><nav class=post-nav><a class=prev href=https://blog.winsphinx.top/post/the-black-friday/><i class=iconfont><svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18"><path d="M691.908486 949.511495l75.369571-89.491197c10.963703-12.998035 10.285251-32.864502-1.499144-44.378743L479.499795 515.267417l277.93508-310.326815c11.338233-12.190647 11.035334-32.285311-.638543-44.850487l-80.46666-86.564541c-11.680017-12.583596-30.356378-12.893658-41.662889-.716314L257.233596 494.235404c-11.332093 12.183484-11.041474 32.266891.657986 44.844348l80.46666 86.564541c1.772366 1.910513 3.706415 3.533476 5.750981 4.877077l306.620399 321.703933C662.505829 963.726242 680.945807 962.528973 691.908486 949.511495z"/></svg></i><span class="prev-text nav-default">The Black Friday</span>
<span class="prev-text nav-mobile">上一篇</span></a>
Expand Down

0 comments on commit 9694ba6

Please sign in to comment.