tizen beta release
[platform/core/base/default-files-tizen.git] / etc / rc.d / init.d / inetd
1 #!/bin/sh
2 #
3 # start/stop inetd super server.
4 #
5 # chkconfig: 2345 20 20
6 #
7 #
8 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
9 if ! [ -x /usr/sbin/inetd ]; then
10         exit 0
11 fi
12
13 checkportmap () {
14     if grep -v "^ *#" /etc/inetd.conf | grep 'rpc/' >/dev/null; then
15         if ! [ -x /usr/bin/rpcinfo ]
16         then
17             echo
18             echo "WARNING: rpcinfo not available - RPC services may be unavailable!"
19             echo "         (Commenting out the rpc services in inetd.conf will"
20             echo "         disable this message)"
21             echo
22         elif ! /usr/bin/rpcinfo -u localhost portmapper >/dev/null 2>/dev/null
23         then
24             echo
25             echo "WARNING: portmapper inactive - RPC services unavailable!"
26             echo "         (Commenting out the rpc services in inetd.conf will"
27             echo "         disable this message)"
28             echo
29         fi
30     fi
31
32
33 case "$1" in
34     start)
35         checkportmap
36         echo -n "Starting internet superserver:"
37         echo -n " inetd" ; start-stop-daemon -S -q -p /var/run/inetd.pid -x /usr/sbin/inetd
38         echo "."
39         ;;
40     stop)
41         echo -n "Stopping internet superserver:"
42         echo -n " inetd" ; start-stop-daemon -K -q -p /var/run/inetd.pid -x /usr/sbin/inetd
43         echo "."
44         ;;
45     reload)
46         echo -n "Reloading internet superserver:"
47         echo -n " inetd"
48         start-stop-daemon -K -q -p /var/run/inetd.pid -s 1
49         echo "."
50         ;;
51     force-reload)
52         $0 reload
53         ;;
54     restart)
55         echo -n "Restarting internet superserver:"
56         echo -n " inetd"
57         start-stop-daemon -K -q -p /var/run/inetd.pid
58         checkportmap
59         start-stop-daemon -S -q -p /var/run/inetd.pid -x /usr/sbin/inetd
60         echo "."
61         ;;
62     *)
63         echo "Usage: /etc/init.d/inetd {start|stop|reload|restart}"
64         exit 1
65         ;;
66 esac
67
68 exit 0
69