~ubuntu-branches/ubuntu/karmic/firebird2.1/karmic

« back to all changes in this revision

Viewing changes to builds/install/arch-specific/linux/misc/firebird.init.d.suse.in

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2008-05-26 23:59:25 UTC
  • Revision ID: james.westby@ubuntu.com-20080526235925-2pnqj6nxpppoeaer
Tags: upstream-2.1.0.17798-0.ds2
ImportĀ upstreamĀ versionĀ 2.1.0.17798-0.ds2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# Copyright (c) 2001 IBPhoenix
 
3
#
 
4
# Author: Pavel Cisar <pcisar@ibphoenix.com>
 
5
#
 
6
# init.d/firebird
 
7
#
 
8
#   and symbolic its link
 
9
#
 
10
# /usr/sbin/rcfirebird
 
11
#
 
12
# System startup script for the Firebird SuperServer
 
13
#
 
14
### BEGIN INIT INFO
 
15
# Provides: firebird
 
16
# Required-Start: $network $remote_fs
 
17
# Required-Stop:  
 
18
# Default-Start:  2 3 5
 
19
# Default-Stop:   0 1 6
 
20
# Description:    Start the Firebird database server.
 
21
### END INIT INFO
 
22
 
 
23
# Source SuSE config
 
24
if [ -r /etc/rc.config ]
 
25
  then
 
26
  . /etc/rc.config
 
27
fi
 
28
 
 
29
if [ -r /etc/sysconfig/firebird ]
 
30
  then
 
31
  . /etc/sysconfig/firebird
 
32
fi
 
33
 
 
34
 
 
35
# Determine the base and follow a runlevel link name.
 
36
base=${0##*/}
 
37
link=${base#*[SK][0-9][0-9]}
 
38
 
 
39
# Force execution if not called by a runlevel directory.
 
40
test $link = $base && START_FIREBIRD="yes"
 
41
test "$START_FIREBIRD" = yes || exit 0
 
42
 
 
43
FIREBIRD=@prefix@
 
44
FBRunUser=firebird
 
45
pidfile=/var/run/firebird/firebird.pid
 
46
 
 
47
export FIREBIRD
 
48
 
 
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
 
53
 
 
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
 
63
. /etc/rc.status
 
64
 
 
65
# First reset status of this service
 
66
rc_reset
 
67
 
 
68
# Return values acc. to LSB for all commands but status:
 
69
# 0 - success
 
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
 
77
#
 
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.
 
82
 
 
83
case "$1" in
 
84
  start)
 
85
        echo -n "Starting Firebird"
 
86
        ## Start daemon with startproc(8). If this fails
 
87
        ## the echo return value is set appropriate.
 
88
 
 
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
 
92
 
 
93
        # Remember status and be verbose
 
94
        rc_status -v
 
95
        ;;
 
96
  stop)
 
97
        echo -n "Shutting down Firebird"
 
98
        ## Stop daemon with killproc(8) and if this fails
 
99
        ## set echo the echo return value.
 
100
 
 
101
        ## I had to use generic approach here - I can't test on suse. AP.
 
102
        if [ -f $pidfile ]
 
103
        then
 
104
                kill `cat $pidfile`
 
105
                sleep 1
 
106
        fi
 
107
                
 
108
 
 
109
        # Remember status and be verbose
 
110
        rc_status -v
 
111
        ;;
 
112
  try-restart)
 
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
 
117
 
 
118
        # Remember status and be quiet
 
119
        rc_status
 
120
        ;;
 
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"
 
125
        $0 stop
 
126
        sleep 1
 
127
        $0 start
 
128
 
 
129
        # Remember status and be quiet
 
130
        rc_status
 
131
        ;;
 
132
  reload)
 
133
 
 
134
        ;;
 
135
  status)
 
136
        echo -n "Checking for Firebird: "
 
137
        ## Check status with checkproc(8), if process is running
 
138
        ## checkproc will return with exit status 0.
 
139
 
 
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
 
145
 
 
146
        # NOTE: checkproc returns LSB compliant status values.
 
147
        checkproc $FIREBIRD/bin/fbserver
 
148
        rc_status -v
 
149
        ;;
 
150
 
 
151
  *)
 
152
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
 
153
        exit 1
 
154
        ;;
 
155
esac
 
156
rc_exit