This handles fairly simple cases, assuming that you'd stop extra services in the reverse order from the way you started them.
There are a few cases that would require some rather silly scripts; a case in point is where you might have to shutdown the httpd service, start zoneminder, start nexus, and then start httpd again. You could shoehorn that into this setup, but you might not care to do so.
/etc/rc.d/rc.local
Code:
#!/bin/sh
#
# The standard way to start a service
# $1 is the name
# $2 is the log message
std_start() {
if [ -x /etc/rc.d/rc.${1} ]; then
if [ -z "${2}" ]; then
echo "starting ${1} service" | $LOGGER
else
echo ${2} | $LOGGER
fi
/etc/rc.d/rc.${1} start
fi
}
for i in $(/usr/bin/cat /etc/rc.d/local_services); do
std_start $i
done
/etc/rc.d/rc.local_shutdown
Code:
#! /bin/sh
# The standard way to stop a service
std_stop() {
if [ -x /etc/rc.d/rc.${1} ]; then
/etc/rc.d/rc.${1} stop
fi
}
for i in $(/usr/bin/tac /etc/rc.d/local_services); do
std_stop $i
done
On my system,
/etc/rc.d/local_services contains...
Code:
docker
vde2
libvirt
postgresql
mongodb
tomcat
Of course, you could just use the SysV method as well.
I'll mark this as solved since I don't really have a problem.