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

Re: setting runlevel to single-user

On 2004 Oct 27, at 6:15 PM, Brett Lymn wrote:

> 1) difficult to automatically manage - you add/remove applications that
>    require scripted start and stops, adding/removing the appropriate 
> lines
>    while maintaining correct order can be challenging to automate.
> 2) the method for stopping a particular service is buried in a 
> monolithic
>    file.

I'd go so far as to say that almost any program, with the notable 
exception of databases, that is incapable of cleanly shutting down with 
a simple SIGTERM is poorly written. Heck, anything--including 
databases--that can't reasonably recover from yanking the power cord 
out the back of the computer is poorly written.

Therefore, you really shouldn't need scripted stops except for your 
databases--and you probably don't have very many of those anyway.

In other words, you're yet again trying to solve a problem that doesn't 
or shouldn't exist.

Starting services I previously addressed. GNU-style programs 
--with-ridiculous --startup-parameters are the biggest part of the 
problem, and that's poor software design. With sane /etc/foo.conf 
files, you shouldn't need more than a flag or two to start any 
service--and if you can't handle that, you're in the worng business.

Looking through /etc/rc.local on a system doing lots of stuff, I see 
lots of stanzas like this:

# Foo
if [ X"${foo_flags}" != X"NO" -a -x /usr/local/sbin/foo -a -f 
	echo -n ' foo';	/usr/local/sbin/foo ${foo_flags}

And, of course, I've got foo_flags="--what --ever" in 
/etc/rc.conf.local. All perfectly maintainable, simple, and clean. 
Stopping foo is almost always just a matter of ``sudo kill `cat 
/var/run/foo.pid`,'' and I just have to ``grep foo /etc/rc.conf.local'' 
to figure out what flags to use to start it. Or, I could just source 
/etc/rc.conf.local and ``foo $foo_flags'' if I'm feeling lazy. Of 
course, if it's truly well-behaved, all I *really* have to do is ``sudo 
kill -HUP `cat /var/run/foo.pid`'' and the program will re-read 
whatever changes I made to the config file. Stopping and starting a 
service in production should be an emergency troubleshooting technique, 
rarely used. (Of course, every system should be rebooted after you've 
finished making changes to the boot process, but that should go without 

I've yet to see any other init system as elegant.



[demime 0.98d removed an attachment of type application/pgp-signature which had a name of PGP.sig]

Visit your host, monkey.org