[svlug] Writing start-up scripts...

Dagmar d'Surreal dagmar at dsurreal.org
Thu Mar 15 13:19:02 PST 2001


On Tue, 13 Mar 2001, Bill Jonas wrote:

> On Mon, Mar 12, 2001 at 06:30:59PM -0800, Eric Pretorious wrote:
> > What's left: To correctly report the status of starting-up. There may not be 
> > anything that can be done though. I guess that this functionality must come 
> > from the qmail-start binary? It's possible to execute /var/qmail/rc multiple 
> > times (effectively executing /var/qmail/bin/qmail-start multiple times) 
> > without any complaint that qmail is already running.
> 
> The shell variable $? contains the exit status of the last completed or
> backgrounded program.
> 
> [ $? ] && echo "Qmail successfully started."
> [ $? ] || echo "Qmail start attempt failed."

I'm not entirely sure if that will work right, but I do get the feeling
that calling test twice is both wasteful and results in a non-intuitive
bit of code.  (It would be handy for obfuscating tho)

Most people would probably find...

if [ $? != 0 ]; then
  echo "Oh joyous day!"
else
  echo "Oh the humanity!"
fi

  ... to be just about as intuitive.





More information about the svlug mailing list