| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# /etc/rc.d/rc.firebirdss |
| 4 |
# |
| 5 |
# Start/stop/restart the firebird server. |
| 6 |
# |
| 7 |
|
| 8 |
fb_install_prefix=@prefix@ |
| 9 |
|
| 10 |
# To run more instances of firebird: |
| 11 |
# Copy @prefix@ somewhere |
| 12 |
# Copy this script under a new name |
| 13 |
# Change INSTANCE and FIREBIRD below (all instance names should be unique) |
| 14 |
# Edit the copied firebird.conf to change at least RemoteServicePort |
| 15 |
# Optionally run rc-update to autostart the new service |
| 16 |
INSTANCE=default |
| 17 |
FIREBIRD=@FB_CONFDIR@ |
| 18 |
|
| 19 |
# No changes needed below for multiple instances |
| 20 |
FBRunUser=firebird |
| 21 |
|
| 22 |
makeFbDir() { |
| 23 |
mDir=${1} |
| 24 |
mode=${2} |
| 25 |
if [ ! -d $mDir ]; then |
| 26 |
rm -rf $mDir |
| 27 |
mkdir $mDir |
| 28 |
if [ "$mode" ]; then |
| 29 |
chmod $mode $mDir |
| 30 |
fi |
| 31 |
fi |
| 32 |
chown $FBRunUser:$FBRunUser $mDir |
| 33 |
} |
| 34 |
runDir=/var/run/firebird |
| 35 |
makeFbDir $runDir |
| 36 |
lockDir=/tmp/firebird |
| 37 |
makeFbDir $lockDir 0770 |
| 38 |
|
| 39 |
pidfile="$runDir/$INSTANCE.pid" |
| 40 |
FULLNAME="Firebird server [$INSTANCE]" |
| 41 |
LD_LIBRARY_PATH=$FIREBIRD/lib:$LD_LIBRARY_PATH |
| 42 |
|
| 43 |
export FIREBIRD LD_LIBRARY_PATH |
| 44 |
|
| 45 |
ISC_USER= |
| 46 |
ISC_PASSWORD= |
| 47 |
export ISC_USER ISC_PASSWORD |
| 48 |
|
| 49 |
GUARDIAN=$FIREBIRD/bin/fbguard |
| 50 |
if [ ! -x $GUARDIAN ]; then |
| 51 |
GUARDIAN=@FB_SBINDIR@/fbguard |
| 52 |
fi |
| 53 |
|
| 54 |
case "$1" in |
| 55 |
'start') echo -n "Starting $FULLNAME: " |
| 56 |
echo $GUARDIAN -pidfile $pidfile -daemon -forever | su $FBRunUser ;; |
| 57 |
'stop') echo -n "Stopping $FULLNAME: " |
| 58 |
if [ -f $pidfile ]; then kill `cat $pidfile`; echo "done."; else echo "error: no PID file."; fi ;; |
| 59 |
'restart') $0 stop ; sleep 1; $0 start ;; |
| 60 |
*) echo "usage $0 start|stop|restart" ;; |
| 61 |
esac |