+# Prints path to PID file for a daemon.
+daemon_pidfile() {
+ if [[ "$#" -lt 1 ]]; then
+ echo 'Missing daemon name.' >&2
+ return 1
+ fi
+
+ local name="$1"; shift
+
+ _daemon_pidfile $name
+}
+
+# Prints path to daemon executable.
+daemon_executable() {
+ if [[ "$#" -lt 1 ]]; then
+ echo 'Missing daemon name.' >&2
+ return 1
+ fi
+
+ local name="$1"; shift
+
+ _daemon_executable $name
+}
+
+# Prints a list of all daemons in the order in which they should be started
+list_start_daemons() {
+ local name
+
+ for name in "${DAEMONS[@]}"; do
+ echo "$name"
+ done
+}
+
+# Prints a list of all daemons in the order in which they should be stopped
+list_stop_daemons() {
+ list_start_daemons | tac
+}
+
+# Checks whether a daemon name is known
+is_daemon_name() {
+ if [[ "$#" -lt 1 ]]; then
+ echo 'Missing daemon name.' >&2
+ return 1
+ fi
+
+ local name="$1"; shift
+
+ for i in "${DAEMONS[@]}"; do
+ if [[ "$i" == "$name" ]]; then
+ return 0
+ fi
+ done
+
+ echo "Unknown daemon name '$name'" >&2
+ return 1
+}
+