Is there a way to find out where init scripts are stored in Linux?

As I asked in the title, I am looking for a script / command to find the correct directory (usually /etc/init.d

or /etc/rc.d/init.d

). Right now I am using

    dirname `find / -name acpid 2> /dev/null | grep /etc/`

      

but sometimes I get more than one result (probably some of the results are link). Any suggestion?

I use acpid because it is a script that should be present in almost every distro that is not prehistoric. If anyone has a suggestion for a better script, let me know, thanks :)

+3


source to share


1 answer


I think your approach is good as the location of the startup scripts depends on the distribution. Just add a parameter of type f to exclude links from your results.



INITDIR=`find / -type f -name acpid 2> /dev/null | grep /etc/`

      

+3


source







All Articles