]> git.pld-linux.org Git - projects/rc-scripts.git/blame - service
- removed unneeded termput hpa
[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
bf14fcab
JR
7VERSION="$(basename $0) ver. 0.91"
8USAGE="Usage: $(basename $0) < option > | --status-all | \
763b88c2 9[ service_name [ command | --full-restart ] ]"
3b917b57 10
763b88c2 11SERVICE=
3b917b57 12
763b88c2 13if [ -d /etc/rc.d/init.d ]; then
1050f687 14 SERVICEDIR="/etc/rc.d/init.d"
763b88c2 15else
1050f687 16 SERVICEDIR="/etc/init.d"
763b88c2
AM
17fi
18
19if [ $# -eq 0 ]; then
1050f687
JR
20 echo "${USAGE}" >&2
21 exit 1
763b88c2
AM
22fi
23
a6c22d3d
AM
24cd /
25while [ $# -gt 0 ]; do
1050f687
JR
26 case "${1}" in
27 --help | -h | --h* )
28 echo "${USAGE}" >&2
29 exit 0
30 ;;
31 --version | -V )
32 echo "${VERSION}" >&2
33 exit 0
34 ;;
35 *)
36 if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
37 cd ${SERVICEDIR}
38 for SERVICE in * ; do
39 case "${SERVICE}" in
40 functions | halt | killall | single| linuxconf| kudzu | \
41 *rpmorig | *rpmnew | *rpmsave | *~ | *.orig)
42 ;;
43 *)
44 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
45 env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" status
46 fi
47 ;;
48 esac
49 done
50 exit 0
51 elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
52 SERVICE="${1}"
53 if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
54 env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" stop
55 env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" start
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
763b88c2
AM
66done
67
68if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
1050f687 69 env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
763b88c2 70else
1050f687
JR
71 echo "${SERVICE}: unrecognized service" >&2
72 exit 1
763b88c2 73fi
1050f687
JR
74
75# This must be last line !
76# vi:syntax=sh
This page took 0.042402 seconds and 4 git commands to generate.