Thomas,

David MENTRE <[EMAIL PROTECTED]> writes:

> I'm interested in a /etc/init.d shell script to launch demexp at startup
> time.

Here is a first try. Paths in the script are obviously wrong (one should
use /var/log/demexp and /var/demexp/) but the general idea is here.

What do you think of it?

#!/bin/sh

DEMEXP_BIN=/home/david/pub/expdem/demexp--dev--0.7/srv/demexp-server
DEMEXP_OPTIONS=""
DEMEXP_LOG_DIR=/tmp
DEMEXP_BASES_DIR=/tmp
DEMEXP_LISTEN_ADDRESS=localhost:50000

# don't execute this script if no binary
test -x $DEMEXP_BIN || exit 0

# where to put our logs?
log_filename=$DEMEXP_LOG_DIR/demexp-`date -Iseconds`

# where are our bases?
bases=$DEMEXP_BASES_DIR/bases.dmxp
pid_file=$DEMEXP_BASES_DIR/bases.pid

start() {
    $DEMEXP_BIN $DEMEXP_OPTIONS \
        --daemon --bases $bases --listen $DEMEXP_LISTEN_ADDRESS \
        --logfile $log_filename.log 2> $log_filename.err &
    return $?
}

stop() {
    kill -SIGQUIT `cat $pid_file`
    return $?
}

case "$1" in
    start)
        start || exit $?
        ;;
    stop)
        stop || exit $?
        ;;
    restart) 
        stop || exit $?
        sleep 8 # hardcoded in server, 7s + 1s of margin
        start || exit $?
        ;;
    reload|force-reload)
        ;;
esac
Best wishes,
d.
-- 
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <[EMAIL PROTECTED]>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A
_______________________________________________
Demexp-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/demexp-dev

Répondre à