2003-11-07 15:18:41 +01:00
|
|
|
#!/sbin/runscript
|
|
|
|
#Gentoo Linux RC script
|
|
|
|
# description: Start/Stop firebird database server
|
|
|
|
#
|
|
|
|
# This file belongs in /etc/init.d where it will be run
|
|
|
|
# on system startup and shutdown to start the background
|
2008-05-08 09:29:44 +02:00
|
|
|
# Firebird database server daemon
|
2003-11-07 15:18:41 +01:00
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/init.d/functions.sh
|
|
|
|
|
2007-11-19 14:21:51 +01:00
|
|
|
# To run more instances of firebird:
|
2007-11-26 16:40:23 +01:00
|
|
|
# Copy @prefix@ somewhere
|
2007-11-19 14:21:51 +01:00
|
|
|
# Copy this script under a new name
|
|
|
|
# Change INSTANCE and FIREBIRD below (all instance names should be unique)
|
|
|
|
# Edit the copied firebird.conf to change at least RemoteServicePort
|
|
|
|
# Optionally run rc-update to autostart the new service
|
|
|
|
INSTANCE=default
|
2009-09-11 12:49:46 +02:00
|
|
|
FIREBIRD=@FB_CONFDIR@
|
2007-11-19 14:21:51 +01:00
|
|
|
|
2003-11-07 15:18:41 +01:00
|
|
|
FBRunUser=firebird
|
2009-09-21 15:39:23 +02:00
|
|
|
|
|
|
|
makeFbDir() {
|
|
|
|
mDir=${1}
|
|
|
|
mode=${2}
|
|
|
|
if [ ! -d $mDir ]; then
|
|
|
|
rm -rf $mDir
|
|
|
|
mkdir $mDir
|
|
|
|
if [ "$mode" ]; then
|
|
|
|
chmod $mode $mDir
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
chown $FBRunUser:$FBRunUser $mDir
|
|
|
|
}
|
|
|
|
runDir=/var/run/firebird
|
|
|
|
makeFbDir $runDir
|
|
|
|
lockDir=/tmp/firebird
|
|
|
|
makeFbDir $lockDir 0770
|
|
|
|
|
|
|
|
pidfile="$runDir/$INSTANCE.pid"
|
2007-11-19 14:21:51 +01:00
|
|
|
FULLNAME="firebird server [$INSTANCE]"
|
|
|
|
LD_LIBRARY_PATH=$FIREBIRD/lib
|
2008-04-25 18:37:30 +02:00
|
|
|
FB_OPTS="-pidfile $pidfile -daemon -forever"
|
2006-04-16 14:58:29 +02:00
|
|
|
|
2007-11-19 14:21:51 +01:00
|
|
|
export FIREBIRD LD_LIBRARY_PATH
|
2003-11-07 15:18:41 +01:00
|
|
|
|
2008-04-25 18:37:30 +02:00
|
|
|
GUARDIAN=$FIREBIRD/bin/fbguard
|
2009-09-11 12:49:46 +02:00
|
|
|
if [ ! -x $GUARDIAN ]; then
|
|
|
|
GUARDIAN=@FB_SBINDIR@/fbguard
|
|
|
|
fi
|
2003-11-07 15:18:41 +01:00
|
|
|
|
2006-04-16 14:58:29 +02:00
|
|
|
start(){
|
2007-11-19 14:21:51 +01:00
|
|
|
ebegin "Starting $FULLNAME"
|
2008-04-25 18:37:30 +02:00
|
|
|
start-stop-daemon --oknodo --start --pidfile $pidfile --chuid $FBRunUser --startas $GUARDIAN -- $FB_OPTS
|
2006-04-16 14:58:29 +02:00
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
|
|
|
stop(){
|
2007-11-19 14:21:51 +01:00
|
|
|
ebegin "Stopping $FULLNAME"
|
2006-04-16 14:58:29 +02:00
|
|
|
start-stop-daemon --stop --pidfile $pidfile --oknodo
|
|
|
|
eend $?
|
|
|
|
}
|
2007-03-09 14:32:17 +01:00
|
|
|
|
|
|
|
restart(){
|
|
|
|
svc_stop
|
|
|
|
sleep 1
|
|
|
|
svc_start
|
|
|
|
}
|