大网数据广告活动
服务器运维问答

Does cron job remain in effect after computer reboots?

· 52CE 我爱测

I have set up cron jobs using the following command crontab -e It seems that if a cron job is scheduled to run within the same day (i.e. computer has not been rebooted), then the cron job runs OK. However, if a cron job is schedu…

问题原文

原帖链接 · user1129812 · CC BY-SA 3.0

I have set up cron jobs using the following command

crontab -e

It seems that if a cron job is scheduled to run within the same day (i.e. computer has not been rebooted), then the cron job runs OK. However, if a cron job is scheduled to run several days later (i.e. computer has been rebooted at least once), then the cron job would be missed.

Moreover, every time when I use "crontab -e" to edit the crontab file in the "nano" editor, the top line shows that I am editing a different file, e.g.

File : /tmp/crontab.PLwi9Z/crontab
File : /tmp/crontab.degfpN/crontab
File : /tmp/crontab.odqbkT/crontab

I want to know that is this normal for crontab and how to schedule a job to run several days later (i.e. after several reboots). I am using an Ubuntu 12.04 amd64 system.

Thanks for any suggestion.

已采纳解答

原帖链接 · user9517 · CC BY-SA 3.0

Moreover, every time when I use "crontab -e" to edit the crontab file in the "nano" editor, the top line shows that I am editing a different file, e.g

The crontab -e command is 'smart', it makes a temporary copy of the file for you to edit. When you save the file it checks that the file is (reasonably) correct before installing it into the correct location on your system.

I want to know that is this normal for crontab and how to schedule a job to run several days later

If your system is turned off when a crontab entry should run then it will be missed. This is normal. If you have jobs that should run even when they have been missed by the system being powered off then take a look at anacron.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。