Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I created a startup script to start/restart/stop a group of applications. I used the lib /etc/init.d/functions in my script. It is working well on my system, but it not working for my client; he is getting the error:

No such file or directory /etc/init.d/functions

Right now I don't know which linux distro my client uses. Is the init.d/functions file different for different Linux distros? If so, how can I find it?

share|improve this question
    
Note that this error can also be caused by Windows line endings. –  Emerson Rocha Luiz Aug 4 '13 at 18:47

3 Answers 3

up vote 8 down vote accepted

It's specific to whatever distribution you're running. Debian and Ubuntu have /lib/lsb/init-functions; SuSE has /etc/rc.status; none of them are compatible with the others. In fact, some distributions don't use /etc/init.d at all, or use it in an incompatible way (Slackware and Arch occur to me off the top of my head; there are others).

share|improve this answer
    
can i know which is the file and where is it located for Redhat 5.5? –  tecman Mar 15 '11 at 20:52
    
Also, how can i find those file name and path? is there any way to do that or is it that we can only find it from the documentation? –  tecman Mar 15 '11 at 20:54
    
I did it by looking, as I have both of those available; I don't have a Red Hat install. But you may have missed the importance of what I said in bold above: the functions in your /etc/init.d/functions don't exist on other distributions. Every distribution has its own rules for /etc/init.d, and its function library (if any) is oriented around those rules; for example, SuSE's rc_status -s. There are some LSB "standard" functions, which are supposed to be found in /lib/lsb/init-functions, but your client may not be running a distribution which has been updated to provide it. –  geekosaur Mar 15 '11 at 21:04

I missed those functions when I moved to Ubuntu, so I created a library that recreates their functionality: efunctions.

share|improve this answer

That is absolutely distribution dependent. You're really going to need to find out the distro in order to write a properly-matching init script.

You can also follow the LSB (Linux Standard Base) specification and hope that the distro in question did too. The current specification dictates that the standard init script functions be available as /lib/lsb/init-functions (see docs here). On Fedora and other Red Hat related distros, that's provided by the redhat-lsb package, which is optional.

So, you really have to figure out what you're targeting. Sorry.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.