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

Re: init scripts and su

On Mon, 26 Jul 2004 19:17, "Miquel van Smoorenburg" <miquels@cistron.nl> 
> The problem is, if the daemon fails to initialize, say there's
> a typo in the config file, it won't be able to print this
> fact to the tty.

The details of the error can be logged to syslog, the main daemon process can 
then return an error code which the script can use to display a message of 
the form "daemon foo failed to start, check syslog for details".

> You probably should attach stdout/stderr to a pipe or pseudo-tty,
> fork off the daemon, and poll() the pipe/pseudo-tty writing all
> output to stdout, until the child dies (actually, daemonizes).

I've done this in the past via an expect script, but it didn't work well with 
some daemons.  asterisk is one example.

http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page

Reply to: