I see various references to "custom" folders in the /etc
folder, with names matching some config file, eg /etc/resolv.conf
and appended with .d
. Examples are resolv.conf.d
or cron.d
.
Where can I find more documentation about this folder structure, the types of files that can be in them, the order of precedence, etc.
This is going to fairly difficult to answer correctly since it is old (and documentation scarce). Unix System V or even earlier than that, so we are talking about 1985 roughly. Plus ... each of the different directories ending with that .d might have a different answer.
In general (I will try to fix on
cron.d
as an example but it will apply to all the others too, with some expections):The
.d
refers to the worddirectory
. In the old days it was used to make a difference between a command and a directory. Inside that directory there will be scripts or text files that this service can handle. Incron.d
there is a fileanacron
that is a text file that is parsed and the results are executed bycron
.Or as explained on the debian mailing list: "Generally when you see that *.d convention, it means "this is a directory holding a bunch of configuration fragments which will be merged together into configuration for some service.".
There is some more information in that link but ... it is simplified for some reason.
How to track down more information:
.d
from the name there is most likely a man page for it. The same goes for the commands inside the directory itself (there is a man pagecron
and one foranacron
; same goes forapparmor
,usb_modeswitch
resolve.conf
and all of them should have a mentioning of the directory and it usage).This will be stated in the man page. Related to
cron
(a part of it, the link above to the man page has a bit more but this is the most interesting):Unless noted otherwise it will be in alphabetical order.