TransWikia.com

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

Unix & Linux Asked by tecman on December 22, 2021

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?

6 Answers

I too got the same error while I run my docker container. It was fixed by adding below line in my Dockerfile

RUN yum install -y initscripts

Answered by Thavaprakash Swaminathan on December 22, 2021

Adding a recent answer

As noted in another answer, Linux Standard Base (LSB) specs provide a way to write platform independent init.d based startup scripts, using the LSB defined init functions as listed here

All LSB compliant distributions (all the big ones) provide the file /lib/lsb/init-functions (which defines the listed functions) in the meta-package lsb-core-noarch which can be installed using the distribution's package manager $PKGMAN $INSTOPT lsb-core-noarch (yum,dnf,apt,...).

An example of such an init script is this.

However, given how systemd is now the de-facto system and service manager for most distributions, it's better to write a systemd service unit instead of writing out an initscript.

Answered by Samveen on December 22, 2021

In CentOS 7 Docker image I had to simply install the package initscripts in order for this script to be installed:

yum install -y initscripts

(Thanks to this issue on docker-library which made me look at this commit)

Answered by Anthony O. on December 22, 2021

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

Answered by Marcus Downing on December 22, 2021

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.

Answered by mattdm on December 22, 2021

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).

Answered by geekosaur on December 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP