更新 Cronie 定时任务配置方法

This commit is contained in:
CallMeR
2026-08-14 23:35:07 +08:00
parent 9beb1fba6a
commit 2fadc58a84
7 changed files with 70 additions and 80 deletions
+7 -12
View File
@@ -384,21 +384,16 @@ $ sudo systemctl status apt-daily-upgrade.timer
本步骤为可选操作,主要设置系统定时重启。
```bash
## 查看系统定时任务
$ sudo crontab -l
## 编辑系统定时任务,编辑器选择 nano
$ sudo crontab -e
```
在配置文件末尾,增加以下内容。
执行以下命令创建 Cronie 系统定时任务文件。
```bash
## 定时任务配置项
30 4 8,24 * * /usr/sbin/shutdown --reboot now
## 创建 Guest OS 定时重启任务
$ sudo tee /etc/cron.d/guest-os-reboot >/dev/null <<'EOF'
30 4 8,24 * * root /usr/sbin/shutdown --reboot now
EOF
## 设置定时任务文件权限
$ sudo chmod 0644 /etc/cron.d/guest-os-reboot
```
### 1.10.清理系统