| | --AqsLC8rIMeq19msA | Content-Type: text/plain; charset=us-ascii | Content-Disposition: inline | | On Wed, May 18, 2005 at 12:44:44AM +0300, Jari Aalto wrote: | > | On Sat, May 14, 2005 at 06:44:16PM +0300, Jari Aalto wrote: | > | > SUGGESTION | > | > Please display a message that dropbear is disabled (like openSSH gives), | > | > something like this in case user tries "reload", "strart" etc. | > | > Start ignored. Dropbear is not enabled in /etc/default/dropbear, | > | Hi Jari, I'm not sure that's necessary. Normally sysv init scripts | > | print along a line 'Starting foo daemon... done' when starting a | > | service. If it doesn't print anything, doesn't this already tell that | > | starting the service didn't work out? | | > How will silence indicate an error? User needs to be notified in case | > of errors like this. Just like the "Starting..." message is followed by: | | Hi, see, I would've answered 'yes' to my question, I'm not yet convinced | that all users think like you. Please see | http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | http://refspecs.freestandards.org/LSB_2.1.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT | and the sysvinit documentation.
Thank you for the pointers. The Debian policy reads: 9.3.2 Writing the scripts [3rd paragraph] "The init.d scripts should ensure that they will behave sensibly if invoked with start when the service is already running,... [3rd last pragraph] "These scripts should not fail obscurely when the configuration files remain but the package has been removed, ..." So, i gather that there are valid reasons for failures. It is just that some things should not cause failure, like missing configuration files. But fulfilling "behave sensible" insists that scrits do signal an error if something goes wrong. It is reasonable to expect that "start" request either: - succeeds (the process starts) - not succeeds (process is not started; an error + reason given) The LSB reads: 8.2. Init Script Actions 0 program is running or service is OK ... [paragraph after the "200-254" status numbers] "...the init script shall return an exit status of zero if the action described by the argument has been successful. Otherwise, the exit status shall be non-zero, as defined below." "In case of an error, while processing any init script action except for "status", the init script shall print an error message and return one of the following non-zero exit status codes." So if the the "start" is not successfull the script should indicate an error. | > Please add error checking and error indication message. | | Anyway, Gerrit. Excellent. Now the behavior is natural and user knwos if something went wrong. But kindly return an error "exit 1" [*], instead of "exit 0", because the following user code would then not work as expected: if /etc/init.d/dropbear start >> $LOG 2>&1; then echo "Dropbear was started in this firewall" >> $LOG else exit 1 fi Thanks, Jari [*] Better erorr codes are defined in LSB 8.2. Init Script Actions; paragraph "In case of an error ... script shall print an error message and return one of the following non-zero exit status codes ... [LIST OF CODES]" | --AqsLC8rIMeq19msA | Content-Type: text/plain; charset=us-ascii | Content-Disposition: attachment; filename=diff | | Index: debian/dropbear.init | =================================================================== | RCS file: /cvs/dropbear/debian/dropbear.init,v | retrieving revision 1.2 | diff -u -r1.2 dropbear.init | --- debian/dropbear.init 20 May 2004 15:47:15 -0000 1.2 | +++ debian/dropbear.init 21 May 2005 14:21:56 -0000 | @@ -14,10 +14,12 @@ | | set -e | | +cancel() { echo "$1" >&2; exit 0; }; | test ! -r /etc/default/dropbear || . /etc/default/dropbear | -test "$NO_START" = "0" || exit 0 | -test -x "$DAEMON" || exit 0 | -test ! -h /var/service/dropbear || exit 0 | +test "$NO_START" = "0" || cancel 'NO_START is not set to zero.' | +test -x "$DAEMON" || cancel "$DAEMON does not exist or is not executable." | +test ! -h /var/service/dropbear || \ | + cancel '/var/service/dropbear exists, service is controlled through runit.' | | test -z "$DROPBEAR_BANNER" || \ | DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER" | | --AqsLC8rIMeq19msA-- | -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]