Linux's /etc/init.d - symlink, hard link, or actual file?

Solution 1:

The LSB standards ( https://refspecs.linuxbase.org/LSB_2.1.0/LSB-generic/LSB-generic/initsrcinstrm.html ) state that it's acceptable for /etc/init.d scripts to be symbolic links:

An init.d file is installed in /etc/init.d (which may be a symlink 
to another location) . . .

But honestly, I think I've only ever seen 3rd party vendor applications use symbolic links.

Edit: Identical verbiage in the 3.0 specifications ( https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-generic/LSB-generic/initsrcinstrm.html )

Solution 2:

The only way I have ever seen initscritps done is to have a regular file in /etc/init.d and a symlink to that file in the directory for each runlevel.

A symlink from /etc/init.d to another location could work. But it would not be normal practice. And if the link was pointing outside of the root partition, you will end up with a setup that easily breaks.

I would recommend sticking with a file in /etc/init.d like other services do.

Solution 3:

I have see issues with RHEL7 not following Symlinks to scripts in /etc/init.d/ Services were not starting on boot and some "service XXX start" commands failed.

The only way to fix it was to copy the file into the init.d directory in place of the symlink. So while it is convenient to just use a symlink copying the file directly is probably better practice.