Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# xinetd        This starts and stops xinetd.
4
#
5
# chkconfig: 345 56 50
6
# description: xinetd is a powerful replacement for inetd. \
7
#	       xinetd has access control mechanisms, extensive \
8
#              logging capabilities, the ability to make services \
9
#              available based on time, and can place \
10
#              limits on the number of servers that can be started, \
11
#              among other things.
12
#
13
# processname: /usr/sbin/xinetd
14
# config: /etc/sysconfig/network
15
# config: /etc/xinetd.conf
16
# pidfile: /var/run/xinetd.pid
17
 
18
 
19
### BEGIN INIT INFO
20
# Provides:
21
# Required-Start: $network
22
# Required-Stop:
23
# Should-Start:
24
# Should-Stop:
25
# Default-Start: 3 4 5
26
# Default-Stop: 0 1 2 6
27
# Short-Description: start and stop xinetd
28
# Description: xinetd is a powerful replacement for inetd. \
29
#              xinetd has access control mechanisms, extensive \
30
#              logging capabilities, the ability to make services \
31
#              available based on time, and can place \
32
#              limits on the number of servers that can be started, \
33
#              among other things.
34
### END INIT INFO
35
 
36
PATH=/sbin:/bin:/usr/bin:/usr/sbin
37
 
38
# Source function library.
39
. /etc/init.d/functions
40
 
41
# Get config.
42
test -f /etc/sysconfig/network && . /etc/sysconfig/network
43
 
44
# More config
45
 
46
test -f /etc/sysconfig/xinetd && . /etc/sysconfig/xinetd
47
 
48
RETVAL=0
49
 
50
prog="xinetd"
51
 
52
start(){
53
    [ -f /usr/sbin/xinetd ] || exit 5
54
    [ -f /etc/xinetd.conf ] || exit 6
55
    # this is suitable way considering SELinux is guarding write
56
    # access to PID file
57
	[ $EUID -eq 0 ] || exit 4
58
 
59
    echo -n $"Starting $prog: "
60
 
61
# Localization for xinetd is controlled in /etc/synconfig/xinetd
62
    if [ -z "$XINETD_LANG" -o "$XINETD_LANG" = "none" -o "$XINETD_LANG" = "NONE" ]; then
63
        unset LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
64
    else
65
        LANG="$XINETD_LANG"
66
        LC_TIME="$XINETD_LANG"
67
        LC_ALL="$XINETD_LANG"
68
        LC_MESSAGES="$XINETD_LANG"
69
        LC_NUMERIC="$XINETD_LANG"
70
        LC_MONETARY="$XINETD_LANG"
71
        LC_COLLATE="$XINETD_LANG"
72
        export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
73
    fi
74
    unset HOME MAIL USER USERNAME
75
    daemon $prog -stayalive -pidfile /var/run/xinetd.pid "$EXTRAOPTIONS"
76
    RETVAL=$?
77
    echo
78
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xinetd
79
    return $RETVAL
80
}
81
 
82
stop(){
83
    [ -f /usr/sbin/xinetd ] || exit 5
84
    [ -f /etc/xinetd.conf ] || exit 6
85
    # this is suitable way considering SELinux is guarding write
86
    # access to PID file
87
	[ $EUID -eq 0 ] || exit 4
88
 
89
    echo -n $"Stopping $prog: "
90
    killproc -p /var/run/xinetd.pid $prog
91
    RETVAL=$?
92
    echo
93
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xinetd
94
    return $RETVAL
95
 
96
}
97
 
98
reload(){
99
    [ -f /usr/sbin/xinetd ] || exit 5
100
    [ -f /etc/xinetd.conf ] || exit 6
101
 
102
    echo -n $"Reloading configuration: "
103
    killproc $prog -HUP
104
    RETVAL=$?
105
    echo
106
    return $RETVAL
107
}
108
 
109
restart(){
110
    stop
111
    start
112
}
113
 
114
condrestart(){
115
    if [ -e /var/lock/subsys/xinetd ] ; then
116
        restart
117
        RETVAL=$?
118
        return $RETVAL
119
    fi
120
    RETVAL=0
121
    return $RETVAL
122
}
123
 
124
 
125
# See how we were called.
126
case "$1" in
127
    start)
128
	start
129
	RETVAL=$?
130
	;;
131
    stop)
132
	stop
133
	RETVAL=$?
134
	;;
135
    status)
136
	status $prog
137
	RETVAL=$?
138
	;;
139
    restart)
140
	restart
141
	RETVAL=$?
142
	;;
143
    reload|force-reload)
144
	reload
145
	RETVAL=$?
146
	;;
147
    condrestart|try-restart)
148
	condrestart
149
	RETVAL=$?
150
	;;
151
    *)
152
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
153
	RETVAL=2
154
esac
155
 
156
exit $RETVAL