Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # /etc/init.d/xinetd -- script to start and stop xinetd. |
| 4 | |
| 5 | # Source function library. |
| 6 | . /etc/init.d/functions |
| 7 | |
| 8 | if test -f /etc/default/xinetd; then |
| 9 | . /etc/default/xinetd |
| 10 | fi |
| 11 | |
| 12 | |
| 13 | test -x /usr/sbin/xinetd || exit 0 |
| 14 | |
| 15 | checkportmap () { |
| 16 | if grep "^[^ *#]" /etc/xinetd.conf | grep -q 'rpc/'; then |
| 17 | if ! rpcinfo -u localhost portmapper >/dev/null 2>&1; then |
| 18 | echo |
| 19 | echo "WARNING: portmapper inactive - RPC services unavailable!" |
| 20 | echo " Commenting out or removing the RPC services from" |
| 21 | echo " the /etc/xinetd.conf file will remove this message." |
| 22 | echo |
| 23 | fi |
| 24 | fi |
| 25 | } |
| 26 | |
| 27 | case "$1" in |
| 28 | start) |
| 29 | checkportmap |
| 30 | echo -n "Starting internet superserver: xinetd" |
| 31 | start-stop-daemon --start --quiet --background --exec /usr/sbin/xinetd -- -pidfile /var/run/xinetd.pid $XINETD_OPTS |
| 32 | echo "." |
| 33 | ;; |
| 34 | stop) |
| 35 | echo -n "Stopping internet superserver: xinetd" |
| 36 | start-stop-daemon --stop --signal 3 --quiet --exec /usr/sbin/xinetd |
| 37 | echo "." |
| 38 | ;; |
| 39 | status) |
| 40 | status /usr/sbin/xinetd; |
| 41 | exit $? |
| 42 | ;; |
| 43 | reload) |
| 44 | echo -n "Reloading internet superserver configuration: xinetd" |
| 45 | start-stop-daemon --stop --signal 1 --quiet --exec /usr/sbin/xinetd |
| 46 | echo "." |
| 47 | ;; |
| 48 | force-reload) |
| 49 | echo "$0 force-reload: Force Reload is deprecated" |
| 50 | echo -n "Forcefully reloading internet superserver configuration: xinetd" |
| 51 | start-stop-daemon --stop --signal 1 --quiet --exec /usr/sbin/xinetd |
| 52 | echo "." |
| 53 | ;; |
| 54 | restart) |
| 55 | $0 stop |
| 56 | $0 start |
| 57 | ;; |
| 58 | *) |
| 59 | echo "Usage: /etc/init.d/xinetd {start|stop|status|reload|force-reload|restart}" |
| 60 | exit 1 |
| 61 | ;; |
| 62 | esac |
| 63 | |
| 64 | exit 0 |