[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Demexp-dev] Writing /etc/init.d script to launch demexp
From: |
David MENTRE |
Subject: |
Re: [Demexp-dev] Writing /etc/init.d script to launch demexp |
Date: |
Wed, 19 Apr 2006 20:54:05 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Thomas,
David MENTRE <address@hidden> 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 <address@hidden>
5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A