[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PROPOSAL: init file actions (draft 2)



On Fri, 4 Jun 1999, Daniel Quinlan wrote:

> In a graphical bootup environment, you could easily redirect any text
> output (to a graphical dialog, a log, or /dev/null).  There's a very
> big difference between the init file printing output and the users
> seeing it.  Distributions can handle it however they wish.

I think it would be better for init scripts to call functions which describe
what's happening, rather then forcing other bits of init to parse (somewhat)
arbitrary text output. This would have the side affect of making init scripts
i18n w/o forcing the writer to do any extra work.

Something like:

	. /etc/rc.d/init.d/functions

	case "$2" in
	    start)
		report starting "dhcpd"
		dhcpd
		if [ $? != 0 ]; then
		    report failed "dhcpd"
		else
		    report started "dhcpcd"
		fi
		;;

	    status)
		if [ -f /var/run/dhcpd.pid && -d /proc/`cat /var/run/dhcpd.pid` ]; then
		    report running "dhcpd"
		else
		    report notrunning "dhcpd"
		fi
		;;
	esac

What do others think about this? Obviously errors would still go to stderr,
but by using some indirection in there folks can control how startup messages
appear with a good deal of accuracy.

Erik

-------------------------------------------------------------------------------
|       "For the next two hours, VH1 will be filled with foul-mouthed,        |
|          crossdressing Australians. Viewer discretion is advised."          |
|                                                                             |
|   Linux Application Development  --  http://www.redhat.com/~johnsonm/lad    |


Reply to: