aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2011-06-23 21:19:45 +0200
committerTom Gundersen <teg@jklm.no>2011-06-23 21:19:45 +0200
commit38c40cb7616a785eaaf78d8643b5d73d01af5ac7 (patch)
tree67056af719904e61f0cdae755ec4616a2fba5706 /functions
parent310c53f367c2d44f15d40c79dbb6428a0d55bcdf (diff)
downloadinitscripts-38c40cb7616a785eaaf78d8643b5d73d01af5ac7.tar.xz
functions: warn if daemons are started recursively
In particular, recomend against using ck_depends. Signed-off-by: Tom Gundersen <teg@jklm.no>
Diffstat (limited to 'functions')
-rw-r--r--functions10
1 files changed, 10 insertions, 0 deletions
diff --git a/functions b/functions
index 3e92fb0..ea5b11f 100644
--- a/functions
+++ b/functions
@@ -4,6 +4,14 @@
# width:
+if [[ $1 == "start" ]]; then
+ if [[ $STARTING ]]; then
+ echo "A daemon is starting another daemon, this is unlikely to work as intended.\n"
+ else
+ export STARTING=1
+ fi
+fi
+
calc_columns () {
STAT_COL=80
if [[ ! -t 1 ]]; then
@@ -201,6 +209,8 @@ start_daemon() {
have_daemon "$1" && /etc/rc.d/"$1" start
}
+# Never use this function, it causes daemons to be stoped in the wrong order.
+# The only way to start a daemon at boot is to add it to the DAEMONS array.
ck_depends() {
for daemon in "$@"; do
ck_daemon "$daemon" && start_daemon "$daemon"