From 38c40cb7616a785eaaf78d8643b5d73d01af5ac7 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Thu, 23 Jun 2011 21:19:45 +0200 Subject: functions: warn if daemons are started recursively In particular, recomend against using ck_depends. Signed-off-by: Tom Gundersen --- functions | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'functions') 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" -- cgit v1.2.3