source: projects/initscripts/trunk/service @ 1108

Revision 1108, 1.7 KB checked in by daisuke, 14 years ago (diff)

import initscripts-8.90.6 from internal cvs repository

RevLine 
[1108]1#!/bin/sh
2
3. /etc/init.d/functions
4
5VERSION="`basename $0` ver. 0.91"
6USAGE="Usage: `basename $0` < option > | --status-all | \
7[ service_name [ command | --full-restart ] ]"
8SERVICE=
9SERVICEDIR="/etc/init.d"
10OPTIONS=
11
12if [ $# -eq 0 ]; then
13   echo "${USAGE}" >&2
14   exit 1
15fi
16
17cd /
18while [ $# -gt 0 ]; do
19  case "${1}" in
20    --help | -h | --h* )
21       echo "${USAGE}" >&2
22       exit 0
23       ;;
24    --version | -V )
25       echo "${VERSION}" >&2
26       exit 0
27       ;;
28    *)
29       if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
30          cd ${SERVICEDIR}
31          for SERVICE in * ; do
32            case "${SERVICE}" in
33              functions | halt | killall | single| linuxconf| kudzu)
34                  ;;
35              *)
36                if ! is_ignored_file "${SERVICE}" \
37                    && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
38                  env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" status
39                fi
40                ;;
41            esac
42          done
43          exit 0
44       elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
45          SERVICE="${1}"
46          if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
47            env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" stop
48            env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" start
49            exit $?
50          fi
51       elif [ -z "${SERVICE}" ]; then
52         SERVICE="${1}"
53       else
54         OPTIONS="${OPTIONS} ${1}"
55       fi
56       shift
57       ;;
58   esac
59done
60
61if [ -f "${SERVICEDIR}/${SERVICE}" ]; then
62   env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
63else
64   echo $"${SERVICE}: unrecognized service" >&2
65   exit 1
66fi
Note: See TracBrowser for help on using the repository browser.