New rc scripts?

Gerard Beekmans gerard at linuxfromscratch.org
Fri Oct 20 14:25:33 PDT 2000


> To add further layers of confusion to the init scripts:

;)

> 1) enable and disable options in the init.d scripts
<cut>

You don't even have to do it with all the symlinks. Try this:

#!/bin/bash
# Begin /etc/init.d/sshd

if [ -f /etc/sysconfig/disable-sshd ]
then
	exit 0
fi

To disable sshd, /usr/bin/touch /etc/sysconfig/disable-sshd

To enable sshd, remove the file

Or use a more elegant way. Perhaps a /etc/sysconfig/daemons

#!/bin/sh
# Begin /etc/sysconfig/daemons

sysklogd=1
sshd=0
postfix=1
apache=1

# End

#!/bin/sh
# Begin sshd

source /etc/sysconfig/daemons

if [ ! sshd ]
then
	exit 0
fi

To enable it you can run a script that does in essence 
	cd /etc/sysconfig
	sed s/"sshd=0"/"sshd=1"/ aemons > daemons-new
	mv daemons-new daemons

I'm sure there are more elegant solutions, just grabbing two of the top of my 
head.

But an enable/disable function would be nice. Let's give it some thought and 
see what other people come up with. A good old fashioned vote in a little 
while can determin what way will  be used

> 2) Who you gonna blame
>
> If I put a mistake in one of my scripts, I get a
> nice message recommending I e-mail lfs-discuss...
>
> How about putting something like this in
> /etc/init.d/rc, print_error_msg():
>
> grep "MAINTAINER:" $i

When in doubt, blame me. If there is somebody's specific code in a script 
it'll be mentioned in the header of the file (look at rc script) but I 
usually make modifications anyways so it's not always their original code, 
but based on theirs.



-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-

-- 
Unsubscribe: send email to lfs-discuss-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message




More information about the lfs-dev mailing list