No such file or directory /etc/init.d/functions
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).
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)
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.