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