Linux command
anacron 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Run
sudo anacron -n
Example
sudo anacron -d
Test
anacron -T
Example
sudo anacron -f
Example
sudo anacron -t [/etc/anacrontab]
说明
anacron is a cron-like job scheduler that doesn't assume the computer is running continuously. It's ideal for laptops and desktop machines that aren't powered on 24/7, ensuring periodic jobs run even if the scheduled time was missed. Unlike cron, which runs jobs at specific times, anacron runs jobs based on periods (daily, weekly, monthly) and tracks the last run date. If a job's period has elapsed since the last run, it executes the job.
参数
- -f
- Force execution ignoring timestamps
- -n
- Run jobs now, ignoring delays
- -d
- Run in foreground (no daemon)
- -s
- Serialize job execution (sequential)
- -T
- Test configuration file syntax only
- -t _file_
- Use alternate anacrontab file
- -S _dir_
- Use alternate spool directory
- -u
- Update timestamps only, don't run jobs
FAQ
What is the anacron command used for?
anacron is a cron-like job scheduler that doesn't assume the computer is running continuously. It's ideal for laptops and desktop machines that aren't powered on 24/7, ensuring periodic jobs run even if the scheduled time was missed. Unlike cron, which runs jobs at specific times, anacron runs jobs based on periods (daily, weekly, monthly) and tracks the last run date. If a job's period has elapsed since the last run, it executes the job.
How do I run a basic anacron example?
Run `sudo anacron -n` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f do in anacron?
Force execution ignoring timestamps