]> git.pld-linux.org Git - projects/rc-scripts.git/blame - service
- cleanups in sysinit + fix for shutting down bridge
[projects/rc-scripts.git] / service
CommitLineData
7824432b
AM
1#!/bin/sh
2
3VERSION="`basename $0` ver. 0.91"
4USAGE="Usage: `basename $0` < option > | --status-all | \
5[ service_name [ command | --full-restart ] ]"
6SERVICE=
7if [ -d /etc/rc.d/init.d ]; then
8 SERVICEDIR="/etc/rc.d/init.d"
9else
10 SERVICEDIR="/etc/init.d"
11fi
12
13if [ $# -eq 0 ]; then
14 echo $"${USAGE}" >&2
15 exit 1
16fi
17
18while [ $# -gt 0 ]
19do
20 case "${1}" in
21 --help | -h | --h* )
22 echo $"${USAGE}" >&2
23 exit 0
24 ;;
25 --version | -V )
26 echo $"${VERSION}" >&2
27 exit 0
28 ;;
29 *)
30 if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
31 cd "${SERVICEDIR}"
32 for SERVICE in *; do
33 case "${SERVICE}" in
34 functions | halt | killall | single| linuxconf| kudzu | \
35 *rpmorig | *rpmnew | *rpmsave | *~ | *.orig)
36 ;;
37 *)
38 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
39 "${SERVICEDIR}/${SERVICE}" status
40 fi
41 ;;
42 esac
43 done
44 exit 0
45 elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
46 SERVICE="${1}"
47 cd "${SERVICEDIR}"
48 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
49 "${SERVICEDIR}/${SERVICE}" stop
50 "${SERVICEDIR}/${SERVICE}" start
51 exit $?
52 fi
53 elif [ -z "${SERVICE}" ]; then
54 SERVICE="${1}"
55 else
56 OPTIONS="${OPTIONS} ${1}"
57 fi
58 shift
59 ;;
60 esac
61done
62
63if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
64 "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
65else
66 echo "${SERVICE}: unrecognized service" >&2
67 exit 1
68fi
This page took 0.282003 seconds and 4 git commands to generate.