#!/bin/sh DAEMON=inetd . /etc/init.d/modlibrc config() { [ -e /tmp/flash/inetd.conf ] || { echo -n "Creating inetd.conf " cp /mod/etc/default.inetd/inetd.conf /tmp/flash/inetd.conf echo "ok." } /usr/bin/modinetd } start() { echo -n 'Starting inetd...' if [ -s "/var/run/$DAEMON.pid" ]; then echo 'already running.' exit 0 fi $DAEMON $INETD_OPTIONS exitval=$? echo "$(pidof "$DAEMON")" > /var/run/$DAEMON.pid if [ "$exitval" -eq 0 ]; then echo 'done.' else echo 'failed.' exit $exitval fi } stop() { modlib_stop || exit 1 } reload() { modlib_reload || exit 1 } case "$1" in ""|load) config modreg cgi 'inetd' 'Inetd' deffile='/mod/etc/default.inetd/inetd_conf.def' [ -r "/tmp/flash/inetd_conf.def" ] && deffile='/tmp/flash/inetd_conf.def' modreg file 'inetd_conf' 'Inetd config' 0 "$deffile" if [ "$INETD_ENABLED" != "yes" ]; then echo "$DAEMON is disabled" 1>&2 exit 1 fi start ;; unload) stop modunreg cgi 'inetd' modunreg file 'inetd_conf' ;; start) start ;; stop) stop ;; reload) reload ;; restart) modlib_restart ;; status) modlib_status ;; *) echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2 exit 1 ;; esac