5

I have noticed some config files having a prefix. E.g. Inside my /etc/php5/cli/conf.d:

  • 05-opcache.ini
  • 10-pdo.ini
  • 20-curl.ini
  • ...

Could someone explain this? I am thinking something along the lines of file permissions or list order.

Thanks!

Robert T.
  • 163
  • 6

3 Answers3

4

This is used in multiple conf file environment, which are conventionaly appli.conf.d directories.

The order of inclusion depends on the alphabetical order.

So with a notation in 00 01..., the .conf files will be treated is the order you decide.

I don't think any other notation will be refused. But it may depend of the software using them.

So, the order of inclusion will be :

00-httpd.conf
01-cgi.conf
02-personnal.conf

But it could also be :

fipscheck.conf
nss-softokn-prelink.conf
Sandburg
  • 206
2

It's to do with order of inclusion (list order).

The config snippets will be iterated over one at a time to produce the full set of configuration options for the application.

By adding the numbers at the beginning of each filename it allows shell scripts (and other types of programs) to easily grab the directory listing and then process the scripts in the order you want.

Some other examples:

/etc/apt/apt.conf.d/
/etc/systcl.d/
/etc/rc*.d/
/etc/fonts/conf.avail/
/etc/fonts/conf.d/
/etc/udev/rules.d/

For some daemons the file permissions and/or the file extension may also determine if the file is included.

Troy
  • 86
  • 1
    Is there a convention for the pairs? Is the whole range used (00-99)? Also, I am assuming the later will overwrite (if the case) the former (i.e. 90-foo.ini settings will overwrite 10-bar.ini settings). Right? – Robert T. Dec 12 '14 at 17:07
  • 1
    Generally the whole range is used. As far as what overrides what I think that is application dependant. If it is a shell script sourcing and processing the settings then I'd expect later config options to override earlier ones. – Troy Dec 14 '14 at 00:19
1

See man run-parts It says, in part:

NAME
       run-parts - run scripts or programs in a directory

SYNOPSIS
       run-parts  [--test]  [--verbose]  [--report]  [--lsbsysinit]  [--regex=RE]  [--umask=umask]  [--arg=argument]  [--exit-on-error] [--help] [--version] [--list]
       [--reverse] [--] DIRECTORY

       run-parts -V

DESCRIPTION
       run-parts runs all the executable files named within constraints described    below, found in directory directory.  Other  files  and  directories  are  silently
       ignored.
waltinator
  • 36,399