当选择使用终端中的“crontab -e”命令为用户创建新的 crontab 时,我注意到似乎使用了某种默认模板来解释 crontab 文件中每个字段的功能。这个模板是集中存储的 - 还是 cron 包的一部分?
答案1
它被硬编码到crontab.c
cron 包源代码的文件中:
if (add_help_text) {
fprintf(NewCrontab,
"# Edit this file to introduce tasks to be run by cron.\n"
"# \n"
"# Each task to run has to be defined through a single line\n"
"# indicating with different fields when the task will be run\n"
"# and what command to run for the task\n"
"# \n"
"# To define the time you can provide concrete values for\n"
"# minute (m), hour (h), day of month (dom), month (mon),\n"
"# and day of week (dow) or use '*' in these fields (for 'any')."
"# \n"
"# Notice that tasks will be started based on the cron's system\n"
"# daemon's notion of time and timezones.\n"
"# \n"
"# Output of the crontab jobs (including errors) is sent through\n"
"# email to the user the crontab file belongs to (unless redirected).\n"
"# \n"
"# For example, you can run a backup of all your user accounts\n"
"# at 5 a.m every week with:\n"
"# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/\n"
"# \n"
"# For more information see the manual pages of crontab(5) and cron(8)\n"
"# \n"
"# m h dom mon dow command\n" );
}