Когда я выполняю crontab-l на новом пользователе, который еще не имеет никаких кронов, результат похож на это и сбои команды и выходы
no crontab for [user]
Если я выполняю crontab-e на новом пользователе, результат следующим образом, и crontab редактор открывается.
no crontab for [user] - using an empty one
Откуда это вытягивает следующий verbage?
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
Конкретно, какой файл содержит эти инструкции.
Я хотел бы выполнить команды как это:
[instructions file] > temp_file
[a cron job] >> temp_file
crontab temp_file
rm temp_file
Однако выполнение этого перестало работать из-за того, чтобы там быть никаким файлом крона для нового пользователя:
crontab -l > temp_file
[a cron job] >> temp_file
crontab temp_file
rm temp_file
Текст на самом деле, кажется, встроен к crontab.c
исходный код, а не чтение из файла во время выполнения:
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" );
}
/* ignore the top few comments since we probably put them there.
*/
Переменная add_help_text
является ненулевым если crontab
сбои для нахождения существующего буферного файла для пользователя:
log_it(RealUser, Pid, "BEGIN EDIT", User);
(void) snprintf(n, MAX_FNAME, CRON_TAB(User));
if (!(f = fopen(n, "r"))) {
if (errno != ENOENT) {
fprintf(stderr, "%s/: fdopen: %s", n, strerror(errno));
exit(ERROR_EXIT);
}
fprintf(stderr, "no crontab for %s - using an empty one\n",
User);
if (!(f = fopen("/dev/null", "r"))) {
perror("/dev/null");
exit(ERROR_EXIT);
}
add_help_text = 1;
}
Это встроено к исполняемому файлу:
strings $(type -p crontab) | less "+/Edit this file to introduce tasks to be run by cron"
Никакая потребность консультироваться с источником. Я согласовываю источник в Одном Истинном Документе.