The Linux Standard Base Core Specification, 22.4. Installation and Removal of Init Scripts says:
An init script shall be installed in /etc/init.d (which may be a symbolic link to another location), by the package installer.
We have a situation which as as result of corporate policy and the standard VM configurations, we are not able to install third-party apps using the standard package installers (yum/rpm) or to the default locations (/opt, etc.). Instead, apps must be installed in an NFS mounted partition (/apps), requiring remote_fs
. We use still init.d to manage stop/start.
Related question that does not provide clarity: Linux's /etc/init.d - symlink, hard link, or actual file?
There are 2 options, both with issues:
- Add wrapper file to
/etc/rc.d/init.d/
. This can be an issue if the third-party updates the wrapper (happens often enough) and we forget to update the init.d copy. - Place a sym-link from
/etc/rc.d/init.d/
to the target file (/etc/rc.d/init.d/myapp -> /apps/myapp/bin/wrapper
).
Second option presents an issue as, even though the wrapper says:
### BEGIN INIT INFO
# Required-Start: $local_fs $network $remote_fs $syslog $time
There is strong likelihood the required remote_fs
is not yet been available upon starting, so the file pointed to by sym-link is not available to read the INIT INFO block expecting remote_fs
and other services from (catch-22). The following error is reported upon startup (ps: /etc/init.d -> rc.d/init.d
):
systemd-sysv-generator[509]: stat() failed on /etc/rc.d/init.d/myapp: No such file or directory
I can't be the first one to face this problem but could not find a best practice recommendation.
I am considering implementing the following workaround; would like to know if there are unknown consequences I am not aware of. Instead of a sym-link, create a "dummy" or "pass-thru" wrapper at /etc/rc.d/init.d/myapp
.
# chkconfig: 345 75 15
# description: myapp
### BEGIN INIT INFO
# Provides: myapp
# Required-Start: $local_fs $network $remote_fs $syslog $time
# Required-Stop: $local_fs $network $remote_fs $syslog $time
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: App Description
### END INIT INFO
/apps/myapp/bin/wrapper "$@"
Seems to work fine in terms of stop/start, etc. Not likely to change (ever ?), unlike the working part of the wrapper.
Anything I've overlooked or not considered?
0 Answers