There is plethora of information regarding the editing of user crontabs: that it should be done through crontab -u or -e. But I could not find the corresponding instructions regarding the system crontab under /etc. How is it supposed to be edited?
Also, there are /etc/cron.[daily|hourly|monthly|weekly] directories with scripts under them. Are these the only directories supported by cron? Can there be a minutely directory?
And when do scripts under these directories run? For example, does the script under /etc/cron.monthly run on the 1st day of the month? What drives this?
Under /etc/cron.d I can see a file called 0hourly. It is a crontab with the single hourly record. Is the name important? I.e. does it only hint me at that this is the file for hourly tasks, or does cron actually match/verify that the 0hourly file contains only hourly entries?
And finally, after a user crontab is saved, does crontab -e command also run crontab -T, to verify the file, or does it install it regardless of whether it is in correct format or not?
Root can edit /etc/crontab using any valid text editor, normally done with vi or vim.
The scripts in the cron.XXX directories are run by cron at the specified intervals. For example, placing a script into the /etc/cron.hourly directory will ensure it gets executed once per hour. Each of the other directories are processed according to their name hourly, daily, weekly, & monthly.
The user crontabs are located under /var/spool/cron. I have one for my user and one for root.
Man crontab, man anacron, etc. will help educate you on how cron works.
Cron does check the user crontab files and /etc/crontab once per minute to see what needs processed at that time. Only the user crontab files and /etc/crontab are able to provide functions more often than hourly.
I don’t think crontab -e does verification. That is up to the user to pay attention to the format. Cron simply ignores improperly formed lines.
Those directories are just a convenience. If you look at the plain cron jobs, you will see the jobs that read those directories, process the scripts in them and you can also see when they run.
If you create the directory and create a job to process that directory there can be.
Did you read man cron, man crontab, man 5 crontab, etc. Each references more.
From man 5 crontab I see this
EXTENSIONS
These special time specification "nicknames" which replace the 5 initial time and date fields, and are prefixed
with the '@' character, are supported:
@reboot : Run once after reboot.
@yearly : Run once a year, ie. "0 0 1 1 *".
@annually : Run once a year, ie. "0 0 1 1 *".
@monthly : Run once a month, ie. "0 0 1 * *".
@weekly : Run once a week, ie. "0 0 * * 0".
@daily : Run once a day, ie. "0 0 * * *".
@hourly : Run once an hour, ie. "0 * * * *".
which seems to indicate when the jobs will be run.
From man cron I see
/etc/crontab
system crontab. Nowadays the file is empty by default. Originally it was usually used to run daily,
weekly, monthly jobs. By default these jobs are now run through anacron which reads /etc/anacrontab
configuration file. See anacrontab(5) for more details.
so the /etc/anacrontab file controls when the jobs in the various directories are run.
$ cat /etc/anacrontab
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
You could have found that by reading the various man pages and following the trail.
I should point out that if you want a job to run once every minute it should be scheduled either in /etc/crontab or a personal crontab file. That is, after all, what they are designed for.
My predicament is that there are no plain cron jobs. In the vanilla F36 install the system crontab is empty. Had it had jobs that reference those directories I probably would have surmised that which you wrote. Absent any such hint I had to assume that the system of directories is somehow internal to cron.
It does have scripts that manage what you surmise. The difference is that not everything now is managed by /etc/crontab but rather by other things that are a little more distributed and by name informative of their function and frequency.
/etc/crontab leads you to man 4 crontabs which then leads you to man 8 anacron and man 5 crontab and each then leads further into the documentation so one can begin to understand the functioning. Note that each file in cron.daily, cron.monthly, etc. begins with a number which ensures the order in which they are processed. Those files are the jobs that used to be processed directly from /etc/crontab, and breaking them out this way makes it simple for the user to add jobs as desired.
The user can write the script to perform the task, test it, then place it into the proper directory and cron will automatically run it at the desired frequency. Simpler than potentially corrupting the syntax of a monolithic /etc/crontab which could break the entire cron system.