summaryrefslogtreecommitdiff
path: root/network/xinetd/rc.xinetd
blob: 17ee20df28d7f99b78d3304685ce80851bc5524a (plain)
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
#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

RETVAL=0

start(){
    echo "Starting xinetd: /usr/sbin/xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid "
    # Need to get rid of localization for external services - 
    # it doesn't make much sense to have i18n on the server side here
    LANG=en_US
    LC_TIME=en_US
    LC_ALL=en_US
    LC_MESSAGES=en_US
    LC_NUMERIC=en_US
    LC_MONETARY=en_US
    LC_COLLATE=en_US
    export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE
    unset HOME MAIL USER USERNAME
    # Make sure /var/lock/subsys exists
    mkdir -p /var/lock/subsys
    /usr/sbin/xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid
    RETVAL=$?
    [ "$RETVAL" = 0 ] && touch /var/lock/subsys/xinetd
    return $RETVAL
}

stop(){
    echo "Stopping xinetd... "
    killall xinetd 2>/dev/null
    RETVAL=$?
    rm -f /var/lock/subsys/xinetd
    return $RETVAL
}

restart(){
    stop
    sleep 1
    start
}

reload(){
    echo "Reloading xinetd configuration..."	
    killall -HUP xinetd 2>/dev/null
    return $?
}

dump(){
  echo -n $"Dumping configuration: "
  killall -USR1 xinetd
  RETVAL=$?
  echo
  return $RETVAL
}

check(){
  echo $"Performing Consistency Check: "
  /bin/kill -s IOT xinetd
  RETVAL=$?
  return $RETVAL
}

status(){
  echo -n $"Checking xinetd: "
  /bin/kill -s IOT xinetd 2>/dev/null
  RETVAL=$?
  if [ $RETVAL = 0 ]; then
    echo "xinetd is running"
  else
    echo "xinetd is not running"
  fi
  return $RETVAL
}

# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    restart)
	restart
	;;
    reload)
	reload
	;;
    dump)
        dump 
	;;
    check)
        check 
	;;
    status)
        status
	;;
    *)
	echo $"Usage: $0 {start|stop|restart|reload|dump|check|status}"
	RETVAL=1
esac

exit $RETVAL