diff options
author | Tom Gundersen <teg@jklm.no> | 2011-06-23 21:19:45 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-06-23 21:19:45 +0200 |
commit | 38c40cb7616a785eaaf78d8643b5d73d01af5ac7 (patch) | |
tree | 67056af719904e61f0cdae755ec4616a2fba5706 | |
parent | 310c53f367c2d44f15d40c79dbb6428a0d55bcdf (diff) | |
download | initscripts-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>
-rw-r--r-- | functions | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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" |