David MENTRE <[EMAIL PROTECTED]> writes:
> 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.
Another thing I would like is to launch demexp under a specific user. Is
doing a "su properuser" in start() enough?
I join latest version of the script that prints proper messages on the
console.
#!/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)
echo -n "Starting demexp server:"
start
;;
stop)
echo -n "Stopping demexp server:"
stop
;;
restart)
echo -n "Restarting demexp server:"
stop
if [ $? -eq 0 ]; then
sleep 8 # hardcoded in server, 7s + 1s of margin
start
fi
;;
reload|force-reload)
;;
esac
if [ $? -eq 0 ]; then
echo " done."
exit 0
else
echo " failed"
exit 1
fi
Best wishes,
d.
--
[EMAIL PROTECTED]
_______________________________________________
Demexp-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/demexp-dev