<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>自动化 on AKHH · AI 时代的学习与实践</title><link>https://akhh.com.cn/tags/%E8%87%AA%E5%8A%A8%E5%8C%96/</link><description>Recent content in 自动化 on AKHH · AI 时代的学习与实践</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><lastBuildDate>Tue, 20 Oct 2026 18:00:00 +0800</lastBuildDate><atom:link href="https://akhh.com.cn/tags/%E8%87%AA%E5%8A%A8%E5%8C%96/index.xml" rel="self" type="application/rss+xml"/><item><title>S5｜定时任务：cron 与 systemd timer</title><link>https://akhh.com.cn/server/s5-timer/</link><pubDate>Tue, 20 Oct 2026 18:00:00 +0800</pubDate><guid>https://akhh.com.cn/server/s5-timer/</guid><description>&lt;blockquote>
&lt;p>&lt;strong>适用&lt;/strong>：所有 Linux
&lt;strong>耗时&lt;/strong>：约 25 分钟
&lt;strong>前置&lt;/strong>：E6（会写脚本）&lt;/p>
&lt;/blockquote>
&lt;p>&lt;strong>让机器自己干活。&lt;/strong> 这一篇讲两种方式：&lt;strong>cron&lt;/strong>（经典）和 &lt;strong>systemd timer&lt;/strong>（现代）。&lt;/p>
&lt;hr>
&lt;h2 id="一cron最经典的方式">一、cron：最经典的方式&lt;/h2>
&lt;h3 id="基本用法">基本用法&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>crontab -e &lt;span style="color:#75715e"># 编辑当前用户的定时任务&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>crontab -l &lt;span style="color:#75715e"># 列出&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>crontab -r &lt;span style="color:#75715e"># 删除全部 ⚠️ 不问确认&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>第一次会问用哪个编辑器。选 nano&lt;/strong>（否则进了 vim 出不来）。&lt;/p></description></item></channel></rss>