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