]> git.pld-linux.org Git - projects/rc-scripts.git/blob - service
- more TOTALNEW merge (ppp, irda, other vlan, wireless). ALPHA
[projects/rc-scripts.git] / service
1 #!/bin/sh
2
3 VERSION="`basename $0` ver. 0.91"
4 USAGE="Usage: `basename $0` < option > | --status-all | \
5 [ service_name [ command | --full-restart ] ]"
6 SERVICE=
7 if [ -d /etc/rc.d/init.d ]; then
8     SERVICEDIR="/etc/rc.d/init.d"
9 else
10     SERVICEDIR="/etc/init.d"
11 fi
12
13 if [ $# -eq 0 ]; then
14    echo $"${USAGE}" >&2
15    exit 1
16 fi
17
18 cd /
19 while [ $# -gt 0 ]; do
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 /
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                   env -i LANG=$LANG "${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 /
48           if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
49             env -i LANG=$LANG "${SERVICEDIR}/${SERVICE}" stop
50             env -i LANG=$LANG "${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
61 done
62
63 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
64    env -i LANG=$LANG "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
65 else
66    echo $"${SERVICE}: unrecognized service" >&2
67    exit 1
68 fi
This page took 0.040247 seconds and 4 git commands to generate.