What is start-stop-daemon ?

The problem I have is that I can find absolutely no documentation 
on "start-stop-daemon".  There is a useless stub of a man page 
that directs one to the --help output or the source code.  
/sbin/start-stop-daemon is apparently a perl script, but I do 
not know perl nor do I find any explaination in the script, 
other than the --help text.  

I think that if it is enough of a Debian standard that virtualy 
all of the scripts that dpkg installs in /etc/init.d use it, 
we are due an explanation of what it does, how it is used, etc.  

I would propose, instead, the use of standard shell commands, 
e.g. 

        DAEMON=/somepath/somedaemon
        CONFIG=/etc/rc.config.d/thisscript

        if [ -f $CONFIG -a -x $DAEMON ] ; then
                [ $VERBOSE ] && echo $0 $1
                . $CONFIG
        else
                [ $VERBOSE ] && echo no ${DAEMON}, exiting.
                exit 0
        fi

        if ps -ef|grep -v grep|grep ${DAEMON} ; then
        # DAEMON is already running, dont bother to start it.
                [ "$1" = "start" ] && exit 0
        else
        # DAEMON is not running, dont bother to stop it.
                [ "$1" = "stop" ] && exit 0
        fi

Without the docs, I don't know if this is what start-stop-daemon 
does, but this sort of thing is routinely done under some of the 
commercial unix's such as Solaris, Dgux, and Hpux.

Jim Pick wrote:
> 
> > So how do I start/stop a plain program during boot/shutdown? Is it
> > safe, that root runs this thing? Should I run it under another
> > account? Which one and do I have to create a homedir for that?
> > This program should only be started once and not by "normal"
> > users. How do I achieve this? Where would such a program be
> > located (based on debian philosophy)?
> 
> I'd run it as another user - definitely not as root.  Especially
> when you are running a binary file where you can't inspect the
> source.
> 
> Just create another user, ie. "des", and give it a home directory.
> 
> Here's a rather long-winded example of using start-stop-daemon
> to run a process as another user.  (This is for a postgresql
> server I have installed in /usr/local)
> 
> start-stop-daemon --start --verbose --exec /usr/local/pgsql/bin/postmaster
> --startas /bin/sh -- -c 'echo "/usr/local/pgsql/bin/postmaster -D/var/pgdata >
> /var/log/postgresql/server.log 2>&1 &" | su postgres'
> 
> There's probably an easier way to do this...
> 
> I was participating too, until they changed the programs around and I
> didn't have enough time to re-setup everything.
> 
> They've completed 2.6753% of the keyspace - wow.  :-)
> 
> Cheers,
> 
>  - Jim
> 
>     ---------------------------------------------------------------
> 
>                Part 1.2   Type: application/pgp-signature


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .

Reply via email to