~jontai/openvista-gtm-integration/bug413322

« back to all changes in this revision

Viewing changes to scripts/etc/init.d/openvista

  • Committer: Jonathan Tai
  • Date: 2009-08-07 16:05:49 UTC
  • mfrom: (74.3.51 bug358242)
  • Revision ID: jon.tai@medsphere.com-20090807160549-z5pfkz1gehlbaxnx
Merge bug 358242 - Create Debian/Ubuntu packages of OpenVista utilities, GT.M

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#
20
20
# chkconfig: 2345 98 01
21
21
# description: Application-level startup/shutdown script for OpenVista Server
 
22
#
 
23
### BEGIN INIT INFO
 
24
# Provides:          openvista
 
25
# Required-Start:    $all openvista-databases
 
26
# Required-Stop:     $all openvista-databases
 
27
# Default-Start:     2 3 4 5
 
28
# Default-Stop:      0 1 6
 
29
# Short-Description: Application-level startup/shutdown script for OpenVista Server
 
30
### END INIT INFO
22
31
 
23
32
 
24
33
# Copyright (C) 2009 Medsphere Systems Corporation
39
48
# Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com.
40
49
 
41
50
 
 
51
# Check the package is still installed.  Traditionally, the test is for a
 
52
# program that is executed later in this script, but it's not trivial to find
 
53
# the location of the mumps binary because multiple verisons could be
 
54
# installed, so look for the functions script instead.
 
55
[ -f /usr/lib/openvista/functions ] || exit 0
 
56
 
42
57
# Source function library.
43
 
. /etc/rc.d/init.d/functions
 
58
[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions
 
59
[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions
44
60
. /usr/lib/openvista/functions
45
61
 
46
62
root="/opt/openvista"
98
114
case $1 in
99
115
    start)
100
116
        if [ -z "$2" ]; then
101
 
            echo "Starting OpenVista..."
 
117
            if function_exists "action"; then
 
118
                echo "Starting OpenVista..."
 
119
            elif function_exists "log_daemon_msg"; then
 
120
                log_daemon_msg "Running startup hooks for OpenVista databases"
 
121
            fi
102
122
    
103
123
            for instance in `ls $root`; do
104
124
                [ -L "$root/$instance/gtm" ] || continue
105
125
 
106
 
                action $"  Running startup hooks for $instance: " run_hook "$instance" ZSTART
 
126
                if function_exists "action"; then
 
127
                    action $"  Running startup hooks for $instance: " run_hook "$instance" ZSTART
 
128
                elif function_exists "log_daemon_msg"; then
 
129
                    log_progress_msg "$instance"
 
130
                    run_hook "$instance" ZSTART || end_msg=1
 
131
                else
 
132
                    run_hook "$instance" ZSTART
 
133
                fi
107
134
            done
 
135
 
 
136
            if function_exists "log_daemon_msg"; then
 
137
                log_end_msg ${end_msg:-0}
 
138
            fi
108
139
        else
109
 
            action $"Running startup hooks for $instance: " run_hook "$instance" ZSTART
 
140
            if function_exists "action"; then
 
141
                action $"Running startup hooks for $instance: " run_hook "$instance" ZSTART
 
142
            elif function_exists "log_daemon_msg"; then
 
143
                log_daemon_msg "Running startup hooks for OpenVista databases" "$instance"
 
144
                run_hook "$instance" ZSTART
 
145
                log_end_msg $?
 
146
            else
 
147
                run_hook "$instance" ZSTART
 
148
            fi
110
149
        fi
111
150
        ;;
112
151
    stop)
113
152
        if [ -z "$2" ]; then
114
 
            echo "Stopping OpenVista..."
 
153
            if function_exists "action"; then
 
154
                echo "Stopping OpenVista..."
 
155
            elif function_exists "log_daemon_msg"; then
 
156
                log_daemon_msg "Running shutdown hooks for OpenVista databases"
 
157
            fi
115
158
 
116
159
            for instance in `ls $root`; do
117
160
                [ -L "$root/$instance/gtm" ] || continue
118
161
 
119
 
                action $"  Running shutdown hooks for $instance: " run_hook "$instance" ZSTOP
 
162
                if function_exists "action"; then
 
163
                    action $"  Running shutdown hooks for $instance: " run_hook "$instance" ZSTOP
 
164
                elif function_exists "log_daemon_msg"; then
 
165
                    log_progress_msg "$instance"
 
166
                    run_hook "$instance" ZSTOP || end_msg=1
 
167
                else
 
168
                    run_hook "$instance" ZSTOP
 
169
                fi
120
170
            done
 
171
 
 
172
            if function_exists "log_daemon_msg"; then
 
173
                log_end_msg ${end_msg:-0}
 
174
            fi
121
175
        else
122
 
            action $"Running shutdown hooks for $instance: " run_hook "$instance" ZSTOP
 
176
            if function_exists "action"; then
 
177
                action $"Running shutdown hooks for $instance: " run_hook "$instance" ZSTOP
 
178
            elif function_exists "log_daemon_msg"; then
 
179
                log_daemon_msg "Running shutdown hooks for OpenVista databases" "$instance"
 
180
                run_hook "$instance" ZSTOP
 
181
                log_end_msg $?
 
182
            else
 
183
                run_hook "$instance" ZSTOP
 
184
            fi
123
185
        fi
124
186
 
125
187
        # give background jobs (e.g., TaskMan) some time to wake up and realize they've been asked to shut down
126
188
        sleep 5
127
189
        ;;
 
190
    restart|force-reload)
 
191
        $0 stop $2
 
192
        $0 start $2
 
193
        ;;
128
194
    *)
129
 
        echo "Usage: openvista {start|stop} [INSTANCE_NAME]" >&2
 
195
        echo "Usage: openvista {start|stop|restart|force-reload} [INSTANCE_NAME]" >&2
130
196
        exit 1
131
197
        ;;
132
198
esac