4

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.

1 Answers1

2

Where can I find more documentation about this folder structure

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 word directory. 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. In cron.d there is a file anacron that is a text file that is parsed and the results are executed by cron.

    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:

  • If you drop the .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 page cron and one for anacron; same goes for apparmor, usb_modeswitch resolve.conf and all of them should have a mentioning of the directory and it usage).

the types of files that can be in them

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):

Support for /etc/cron.d is included in the cron daemon itself, which handles this location as the system-wide crontab spool. This directory can contain any file defining tasks following the format used in /etc/crontab, i.e. unlike the user cron spool, these files must provide the username to run the task as in the task definition.

the order of precedence

Unless noted otherwise it will be in alphabetical order.

Rinzwind
  • 299,756