2
# Copyright (c) 2001 IBPhoenix
4
# Author: Pavel Cisar <pcisar@ibphoenix.com>
8
# and symbolic its link
10
# /usr/sbin/rcfirebird
12
# System startup script for the Firebird SuperServer
16
# Required-Start: $network $remote_fs
18
# Default-Start: 2 3 5
20
# Description: Start the Firebird database server.
24
if [ -r /etc/rc.config ]
29
if [ -r /etc/sysconfig/firebird ]
31
. /etc/sysconfig/firebird
35
# Determine the base and follow a runlevel link name.
37
link=${base#*[SK][0-9][0-9]}
39
# Force execution if not called by a runlevel directory.
40
test $link = $base && START_FIREBIRD="yes"
41
test "$START_FIREBIRD" = yes || exit 0
45
pidfile=/var/run/firebird/firebird.pid
49
# Check the file is there and is executable.
50
[ -x $FIREBIRD/bin/fbmgr ] || exit 5
51
[ -x $FIREBIRD/bin/fbguard ] || exit 5
52
[ -x $FIREBIRD/bin/fbserver ] || exit 5
54
# Shell functions sourced from /etc/rc.status:
55
# rc_check check and set local and overall rc status
56
# rc_status check and set local and overall rc status
57
# rc_status -v ditto but be verbose in local rc status
58
# rc_status -v -r ditto and clear the local rc status
59
# rc_failed set local and overall rc status to failed
60
# rc_failed <num> set local and overall rc status to <num><num>
61
# rc_reset clear local rc status (overall remains)
62
# rc_exit exit appropriate to overall rc status
65
# First reset status of this service
68
# Return values acc. to LSB for all commands but status:
70
# 1 - generic or unspecified error
71
# 2 - invalid or excess argument(s)
72
# 3 - unimplemented feature (e.g. "reload")
73
# 4 - insufficient privilege
74
# 5 - program is not installed
75
# 6 - program is not configured
76
# 7 - program is not running
78
# Note that starting an already running service, stopping
79
# or restarting a not-running service as well as the restart
80
# with force-reload (in case signalling is not supported) are
81
# considered a success.
85
echo -n "Starting Firebird"
86
## Start daemon with startproc(8). If this fails
87
## the echo return value is set appropriate.
89
# NOTE: startproc return 0, even if service is
90
# already running to match LSB spec.
91
startproc -u $FBRunUser $FIREBIRD/bin/fbguard -pidfile $pidfile -forever
93
# Remember status and be verbose
97
echo -n "Shutting down Firebird"
98
## Stop daemon with killproc(8) and if this fails
99
## set echo the echo return value.
101
## I had to use generic approach here - I can't test on suse. AP.
109
# Remember status and be verbose
113
## Stop the service and if this succeeds (i.e. the
114
## service was running before), start it again.
115
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
116
$0 status >/dev/null && $0 restart
118
# Remember status and be quiet
121
restart|force-reload)
122
## Stop the service and regardless of whether it was
123
## running or not, start it again.
124
echo "Restarting service Firebird"
129
# Remember status and be quiet
136
echo -n "Checking for Firebird: "
137
## Check status with checkproc(8), if process is running
138
## checkproc will return with exit status 0.
140
# Status has a slightly different for the status command:
141
# 0 - service running
142
# 1 - service dead, but /var/run/ pid file exists
143
# 2 - service dead, but /var/lock/ lock file exists
144
# 3 - service not running
146
# NOTE: checkproc returns LSB compliant status values.
147
checkproc $FIREBIRD/bin/fbserver
152
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"