linux - 如何测试命令anacron?

标签 linux

uname -r
4.5.5-300.fc24.x86_64

我已将 0 0 test touch ~/ana.cron 附加到 /etc/anacrontab。但是在重启或从 sleep 中恢复或运行 sudo anacron -f 后没有任何效果。我找不到输出文件 ana.cron

cat/etc/anacrontab

# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1   5   cron.daily      nice run-parts /etc/cron.daily
7   25  cron.weekly     nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly        nice run-parts /etc/cron.monthly
0 0 test touch ~/ana.cron

如何解决?

最佳答案

我不确定period 是否可以为 0。

1 0 test.daily nice run-parts touch ~/ana.cron

如果你想让你的任务在启动时运行,那么使用@reboot

@reboot test.reboot nice run-parts touch ~/ana.cron

关于linux - 如何测试命令anacron?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42466259/

相关文章:

linux - 在哪里可以找到 UDP 的 Linux 实现的源代码?

c++ - 为 ARM 架构编译我的 C++ 代码

xml - 如何在 Linux 中使用 sed 更改 XML 文件中的值?

linux - 需要帮助在 CentOS 5.5 上设置 Apache,得到 403

php - Laravel + SQLite = SQLSTATE[HY000] 一般错误 : 8 attempt to write a readonly database

python - aws crontab 无法使用子进程工作

linux - 即使磁盘空间不足,也持续运行 dd 命令

linux - 每 60 秒复制一个文件 bash

linux - 如何删除命令结果之前的 "Note:"?

linux - 为什么在 psql cli 中使用 WITH 语句时会出现错误?