#!/bin/bash
#
-# Copyright (C) 2009 Google Inc.
+# Copyright (C) 2009, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
return 0
}
+# 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
done
}
+status_all() {
+ local daemons="$1" status ret
+
+ if [ -z "$daemons" ]; then
+ daemons=$($DAEMON_UTIL list-start-daemons)
+ fi
+
+ status=0
+
+ for i in $daemons; do
+ if status_of_proc $($DAEMON_UTIL daemon-executable $i) $i; then
+ ret=0
+ else
+ ret=$?
+ # Use exit code from first failed call
+ if [ "$status" -eq 0 ]; then
+ status=$ret
+ fi
+ fi
+ done
+
+ exit $status
+}
+
if [ -n "$2" ] && ! errmsg=$($DAEMON_UTIL is-daemon-name "$2" 2>&1); then
log_failure_msg "$errmsg"
exit 1
stop_all "$2"
start_all "$2"
;;
+ status)
+ status_all "$2"
+ ;;
*)
log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
exit 1