Reputation: 97
As I asked in the title, I'm looking for a script/command to find the correct directory (usually /etc/init.d
or /etc/rc.d/init.d
).
Right now I'm 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'm using acpid because it is a script that should be present in almost every distribution that is not prehistoric. If someone has a suggestion for a better script, let me know, thanks :)
Upvotes: 4
Views: 1509
Reputation: 1598
I believe that your approach is quite good as the location of the startup scripts is distro-dependable. Simply add -type f option to exclude links from your results.
INITDIR=`find / -type f -name acpid 2> /dev/null | grep /etc/`
Upvotes: 3