author | Gipson Pulla <gipson.pulla@oracle.com> |
Sun, 18 Dec 2016 20:43:50 -0800 | |
changeset 7506 | 497cdd942859 |
parent 6277 | 073d7b623ddf |
permissions | -rw-r--r-- |
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
1 |
#!/sbin/sh |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
2 |
# |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
4 |
# |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
8 |
# |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
13 |
# |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
19 |
# |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
21 |
# |
6033
9719142d2b5d
23227671 Upgrade MySQL 5.5 to 5.5.49 on Solaris
Gipson Pulla <gipson.pulla@oracle.com>
parents:
1541
diff
changeset
|
22 |
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
23 |
# |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
24 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
25 |
. /lib/svc/share/smf_include.sh |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
26 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
27 |
# SMF_FMRI is the name of the target service. This allows multiple instances |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
28 |
# to use the same script. |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
29 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
30 |
if [ -z $SMF_FMRI ]; then |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
31 |
echo "SMF framework variables are not initialized." |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
32 |
exit $SMF_EXIT_ERR |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
33 |
fi |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
34 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
35 |
getproparg() { |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
36 |
val=`svcprop -p $1 $SMF_FMRI` |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
37 |
[ -n "$val" ] && echo $val |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
38 |
} |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
39 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
40 |
MYSQLCNF=`getproparg mysql/cnf` |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
41 |
MYSQLBIN=`getproparg mysql/bin` |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
42 |
MYSQLDATA=`getproparg mysql/data` |
6277
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
43 |
STARTTIMEOUT=180 |
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
44 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
45 |
if [ -z ${MYSQLCNF} ]; then |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
46 |
echo "mysql/cnf property not set" |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
47 |
exit $SMF_EXIT_ERR_CONFIG |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
48 |
fi |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
49 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
50 |
if [ -z ${MYSQLBIN} ]; then |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
51 |
echo "mysql/bin property not set" |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
52 |
exit $SMF_EXIT_ERR_CONFIG |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
53 |
fi |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
54 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
55 |
if [ -z ${MYSQLDATA} ]; then |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
56 |
echo "mysql/data property not set" |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
57 |
exit $SMF_EXIT_ERR_CONFIG |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
58 |
fi |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
59 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
60 |
if [ ! -d ${MYSQLDATA} ]; then |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
61 |
echo "mysql/data directory ${MYSQLDATA} is not a valid MySQL data directory" |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
62 |
exit $SMF_EXIT_ERR_CONFIG |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
63 |
fi |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
64 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
65 |
if [ ! -d ${MYSQLDATA}/mysql ]; then |
6277
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
66 |
echo ${MYSQLBIN}/mysql_install_db --user=mysql --datadir=${MYSQLDATA} |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
67 |
${MYSQLBIN}/mysql_install_db --user=mysql --datadir=${MYSQLDATA} |
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
68 |
fi |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
69 |
|
7506
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
70 |
|
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
71 |
getpidfile() { |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
72 |
ret=$(${MYSQLBIN}/my_print_defaults --defaults-file=${MYSQLCNF} \ |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
73 |
mysqld | grep '^--pid-file=' | cut -d= -f2- | tail -1) |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
74 |
[ -z "$ret" ] && ret="${MYSQLDATA}/$(/usr/bin/uname -n).pid" |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
75 |
echo $ret |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
76 |
} |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
77 |
|
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
78 |
getsockfile() { |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
79 |
ret=$(${MYSQLBIN}/my_print_defaults --defaults-file=${MYSQLCNF} \ |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
80 |
mysqld | grep '^--socket=' | cut -d= -f2- | tail -1) |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
81 |
[ -z "$ret" ] && ret="/tmp/mysql.sock" |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
82 |
echo $ret |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
83 |
} |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
84 |
|
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
85 |
PIDFILE=$(getpidfile) |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
86 |
SOCKFILE=$(getsockfile) |
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
87 |
|
6277
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
88 |
# ping function which return success when mysqld starts accepting connections |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
89 |
# or return failure in case of timeout after $STARTTIMEOUT seconds. |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
90 |
# using this function in mysql_start(), method waits/blocks to mysqld is really ready, |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
91 |
# which might take some time in case of recovery. |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
92 |
|
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
93 |
mysql_pinger() { |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
94 |
mysqld_safe_pid=$1 |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
95 |
timer=$STARTTIMEOUT |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
96 |
ret=0 |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
97 |
while [ $timer -gt 0 ]; do |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
98 |
sleep 1 |
7506
497cdd942859
22959660 mysql SMF service must not hardcode pid-file, socket and log-error
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6277
diff
changeset
|
99 |
${MYSQLBIN}/mysqladmin --no-defaults --socket=${SOCKFILE} --user=UNKNOWN_MYSQL_USER ping >/dev/null 2>&1 && break |
6277
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
100 |
timer=$(expr $timer - 1) |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
101 |
|
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
102 |
# Check if mysqld_safe is still alive, if not there is no hope |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
103 |
if ! kill -0 $mysqld_safe_pid >/dev/null 2>&1 ; then |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
104 |
ret=1 |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
105 |
break |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
106 |
fi |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
107 |
done |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
108 |
|
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
109 |
# Did we timeout? |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
110 |
if [ $timer = 0 ]; then |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
111 |
echo "MySQL Database start up timeout after ${STARTTIMEOUT}s" |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
112 |
ret=1 |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
113 |
fi |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
114 |
return $ret |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
115 |
} |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
116 |
|
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
117 |
# refresh method for this service is not defined because mysqld by itself |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
118 |
# cannot accept a HUP signal to reload the configuration file my.cnf |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
119 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
120 |
mysql_start() { |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
121 |
echo ${MYSQLBIN}/mysqld_safe --defaults-file=${MYSQLCNF} --user=mysql --datadir=${MYSQLDATA} --pid-file=${PIDFILE} |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
122 |
${MYSQLBIN}/mysqld_safe --defaults-file=${MYSQLCNF} --user=mysql --datadir=${MYSQLDATA} --pid-file=${PIDFILE} > /dev/null & |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
123 |
|
6277
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
124 |
if mysql_pinger $! ; then |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
125 |
echo "Starting service MySQL" |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
126 |
else |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
127 |
echo "Failed to start service MySQL" |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
128 |
exit $SMF_EXIT_ERR |
073d7b623ddf
21150630 mysql SMF instances should check to see if it's really online before returning
Gipson Pulla <gipson.pulla@oracle.com>
parents:
6033
diff
changeset
|
129 |
fi |
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
130 |
} |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
131 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
132 |
case "$1" in |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
133 |
'start') |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
134 |
mysql_start |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
135 |
;; |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
136 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
137 |
*) |
6033
9719142d2b5d
23227671 Upgrade MySQL 5.5 to 5.5.49 on Solaris
Gipson Pulla <gipson.pulla@oracle.com>
parents:
1541
diff
changeset
|
138 |
echo "Usage: $0 start" |
1541
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
139 |
exit 1 |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
140 |
;; |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
141 |
|
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
142 |
esac |
b62d499c009a
PSARC 2013/333 Update MySQL to 5.5; EOF MySQL 5.1
Akhil Mohan <akhil.mohan@oracle.com>
parents:
diff
changeset
|
143 |
exit $SMF_EXIT_OK |