[英]Linux cron job overwrite file
如果cron作业创建具有常量名称的存档,则存档将在下一个cron作业中替换为新存档,或者因具有此名称的文件已存在而终止?
There's no magic in cron
- it just runs a program at a given timing. 在
cron
没有魔法 - 它只是在给定的时间运行一个程序。 If that program has the logic to check if the archive exists, it will still have it when run via as a cron job. 如果该程序具有检查存档是否存在的逻辑,则在作为cron作业运行时它仍将具有该存档。 If it just overwrites the archive, it will continue doing so when run as a cron jbo.
如果它只是覆盖存档,它将在作为cron jbo运行时继续这样做。
Cron just run your command, so it's up to you how this command may look. Cron只是运行你的命令,所以由你来决定这个命令的外观。 For example:
例如:
0 8 * * * rm -rf arc.zip && zip -r arc.zip /tmp
This cron runs every day at 8am and performs next steps: 这个cron每天早上8点运行并执行后续步骤:
arc.zip
arc.zip
arc.zip
from /tmp
directory /tmp
目录创建新的存档arc.zip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.