Re: [MonetDB-users] Shell script to start MonetDB as service on Linux
Fabian, thanks for your quick reply, and pointing me in the right direction.
We are running on OpenSuse, and for the moment have settled on the following
script. I'm sure it could use a lot of improvement, but we are up and running
**********
!/bin/sh
# Portions Copyright (c) 1995-2002 SuSE Linux AG Nuernberg, Germany.
# Author: Lenz Grimmer
On 13-12-2007 14:48:15 -0500, McKennirey.Matthew wrote:
Fabian, thanks for your quick reply, and pointing me in the right direction. We are running on OpenSuse, and for the moment have settled on the following script. I'm sure it could use a lot of improvement, but we are up and running **********
# update these as appropriate for your server MDB_USER='root' MDB_GROUP='root'
This is really a bad idea. If you care about security a bit, make a user and group for monetdb and run everything as that user.
MDB_HOME=/srv/monetdb MDB_BINDIR=/srv/monetdb/bin
echo "" echo "Using configuration at " $MDB_HOME/etc/monetdb5.conf echo ""
# Test, if path to merovingian is valid unset MEROVINGIAN if test -x $MDB_BINDIR/merovingian then MEROVINGIAN=$MDB_BINDIR/merovingian fi test "$MEROVINGIAN" || { echo "MonetDB daemon (merovingian) is not available at indicated path:" $MDB_BINDIR "verify path settings in /etc/monetdb"; rc_failed 5; rc_status -v; rc_exit; }
depend() { use net }
start(){ echo -n "Starting MonetDB/SQL" startproc -s -u $MDB_USER -g $MDB_GROUP $MDB_BINDIR/merovingian
# Rmember status and be verbose rc_status -v }
stop() { echo -n "Stopping MonetDB/SQL"
# shut down mserver if it is running kill -INT $(pidof mserver5)
Don't do this. Merovingian caters for this, using a timeout (see config file) and eventually even SIGKILLs it if the mserver doesn't reply. Telling merovingian to stop, as you do below is sufficient.
# stop merovingian daemon kill -INT $(pidof merovingian)
# Remember status and be verbose rc_status -v }
status(){ echo -n "Checking for MonetDb service: "
# NOTE: checkproc returns LSB compliant status values. checkproc $MEROVINGIAN rc_status -v }
case "$1" in start) start ;; stop) stop ;; status) status ;; restart) stop start ;; *) echo "Usage: {start|stop|status|restart}" exit 1 ;; esac rc_exit
participants (2)
-
Fabian Groffen
-
McKennirey.Matthew