root/trunk/freewrt/package/busybox/files/inetd.init

Revision 3512, 394 bytes (checked in by tg, 5 years ago)

fix the problem that a “/etc/init.d/ntpd restart” wouldn’t work
because it uses “killall ntpd” and nukes itself: on execution,
run mksh(1) with ourselves first, to make sure that killall/pkill
will see our process name as “mksh” instead of e.g. “…/ntpd”.

Line 
1 #!/bin/sh
2 test x"$1" = x"really" || exec /bin/mksh "$0" really "$@"
3 shift
4 #FWINIT 41
5 . /etc/rc.conf
6 case $1 in
7 autostart)
8         test x"$inetd" = x"NO" && exit 0
9         test -e /etc/inetd.conf || exit 0
10         exec sh $0 start
11         ;;
12 start)
13         /usr/sbin/inetd
14         ;;
15 autostop)
16         ;;
17 stop)
18         killall inetd
19         ;;
20 restart)
21         sh $0 stop
22         exec sh $0 start
23         ;;
24 *)
25         echo "Usage: $0 {start | stop | restart}"
26         exit 1
27         ;;
28 esac
29 exit $?
Note: See TracBrowser for help on using the browser.