3 ###########################################################################
6 # A convenient wrapper for the /etc/init.d init scripts.
8 # This script is a modified version of the /sbin/service utility found on
9 # Red Hat/Fedora systems (licensed GPLv2+).
11 # Copyright (C) 2006 Red Hat, Inc. All rights reserved.
12 # Copyright (C) 2008 Canonical Ltd.
13 # * August 2008 - Dustin Kirkland <kirkland@canonical.com>
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 # On Debian GNU/Linux systems, the complete text of the GNU General
30 # Public License can be found in `/usr/share/common-licenses/GPL-2'.
31 ###########################################################################
36 skeleton | README | *.dpkg-dist | *.dpkg-old | rc | rcS | single | reboot | bootclean.sh)
43 VERSION="`basename $0` ver. 0.91-ubuntu1"
44 USAGE="Usage: `basename $0` < option > | --status-all | \
45 [ service_name [ command | --full-restart ] ]"
47 SERVICEDIR="/etc/init.d"
56 while [ $# -gt 0 ]; do
67 if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
71 functions | halt | killall | single| linuxconf| kudzu)
74 if ! is_ignored_file "${SERVICE}" \
75 && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
76 if ! grep -qs "\Wstatus)" "$SERVICE"; then
77 #printf " %s %-60s %s\n" "[?]" "$SERVICE:" "unknown" 1>&2
78 echo " [ ? ] $SERVICE" 1>&2
81 out=$(env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
82 if [ "$?" = "0" -a -n "$out" ]; then
83 #printf " %s %-60s %s\n" "[+]" "$SERVICE:" "running"
84 echo " [ + ] $SERVICE"
87 #printf " %s %-60s %s\n" "[-]" "$SERVICE:" "NOT running"
88 echo " [ - ] $SERVICE"
92 #env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status
98 elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
100 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
101 env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" stop
102 env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" start
105 elif [ -z "${SERVICE}" ]; then
108 OPTIONS="${OPTIONS} ${1}"
115 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
116 env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${OPTIONS}
118 echo "${SERVICE}: unrecognized service" >&2