1 |
On 2012-02-05 3:06 PM, Alan McKinnon <alan.mckinnon@×××××.com> wrote: |
2 |
> In your shoes what I would be doing now is backup your entire mysql |
3 |
> install (everything listed in "equery files mysql"), delete the package |
4 |
> (emerge -C) and remerge mysql. |
5 |
> |
6 |
> Then check if starting and stopping works correctly. I suspect you'll |
7 |
> find it will. Now you just need to diff these new files with your |
8 |
> backups and find differences. |
9 |
> |
10 |
> Yes, this is sort of the long way round but you're not having much luck |
11 |
> asking "anyone seen this before?", so now it's time to bring out the |
12 |
> big guns |
13 |
|
14 |
Well, I'd much prefer some more basic troubleshooting first... |
15 |
|
16 |
I've asked for some kind soul/souls to share their init scripts so I can |
17 |
compare - but I guess I couldg go first... here is the contents of |
18 |
/etc/init.d/mysql: |
19 |
|
20 |
#!/sbin/runscript |
21 |
# Copyright 1999-2011 Gentoo Foundation |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
# $Header: |
24 |
/var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/mysql-5.1.53-init.d,v |
25 |
1.1 2011/01/13 20:06:06 robbat2 Exp $ |
26 |
|
27 |
depend() { |
28 |
use net.lo |
29 |
# localmount needed for $basedir |
30 |
need localmount |
31 |
} |
32 |
|
33 |
get_config() { |
34 |
my_print_defaults --config-file="$1" mysqld | |
35 |
sed -n -e "s/^--$2=//p" |
36 |
} |
37 |
|
38 |
mysql_svcname() { |
39 |
local ebextra= |
40 |
case "${SVCNAME}" in |
41 |
mysql*) ;; |
42 |
*) ebextra=" (mysql)" ;; |
43 |
esac |
44 |
echo "${SVCNAME}${ebextra}" |
45 |
} |
46 |
|
47 |
start() { |
48 |
# Check for old conf.d variables that mean migration was not |
49 |
yet done. |
50 |
local varlist="${!mysql_slot_*} ${!MYSQL_BLOG_PID_FILE*} |
51 |
${!STOPTIMEOUT*}" |
52 |
varlist="${varlist// /}" |
53 |
# Yes, MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING is a hidden variable. |
54 |
# It does have a use in testing, as it is possible to build a |
55 |
config file |
56 |
# that works with both the old and new init scripts simulateously. |
57 |
if [ -n "${varlist}" -a -z |
58 |
"${MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING}" ]; then |
59 |
eerror "You have not updated your conf.d for the new |
60 |
mysql-init-scripts-2 revamp." |
61 |
eerror "Not proceeding because it may be dangerous." |
62 |
return 1 |
63 |
fi |
64 |
|
65 |
# Now we can startup |
66 |
ebegin "Starting $(mysql_svcname)" |
67 |
|
68 |
MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}" |
69 |
|
70 |
if [ ! -r "${MY_CNF}" ] ; then |
71 |
eerror "Cannot read the configuration file \`${MY_CNF}'" |
72 |
return 1 |
73 |
fi |
74 |
|
75 |
# tail -n1 is critical as these we only want the last instance |
76 |
of the option |
77 |
local basedir=$(get_config "${MY_CNF}" basedir | tail -n1) |
78 |
local datadir=$(get_config "${MY_CNF}" datadir | tail -n1) |
79 |
local pidfile=$(get_config "${MY_CNF}" pid-file | tail -n1) |
80 |
local socket=$(get_config "${MY_CNF}" socket | tail -n1) |
81 |
|
82 |
if [ ! -d "${datadir}" ] ; then |
83 |
eerror "MySQL datadir \`${datadir}' is empty or invalid" |
84 |
eerror "Please check your config file \`${MY_CNF}'" |
85 |
return 1 |
86 |
fi |
87 |
|
88 |
if [ ! -d "${datadir}"/mysql ] ; then |
89 |
eerror "You don't appear to have the mysql database |
90 |
installed yet." |
91 |
eerror "Please run /usr/bin/mysql_install_db to have |
92 |
this done..." |
93 |
return 1 |
94 |
fi |
95 |
|
96 |
local piddir="${pidfile%/*}" |
97 |
if [ ! -d "$piddir" ] ; then |
98 |
mkdir "$piddir" && \ |
99 |
chown mysql "$piddir" |
100 |
rc=$? |
101 |
if [ $rc -ne 0 ]; then |
102 |
eerror "Directory $piddir for pidfile does not |
103 |
exist and cannot be created" |
104 |
return 1 |
105 |
fi |
106 |
fi |
107 |
|
108 |
local startup_timeout=${STARTUP_TIMEOUT:-900} |
109 |
local startup_early_timeout=${STARTUP_EARLY_TIMEOUT:-1000} |
110 |
local tmpnice="${NICE:+"--nicelevel "}${NICE}" |
111 |
local tmpionice="${IONICE:+"--ionice "}${IONICE}" |
112 |
start-stop-daemon \ |
113 |
${DEBUG/*/"--verbose"} \ |
114 |
--start \ |
115 |
--exec "${basedir}"/sbin/mysqld \ |
116 |
--pidfile "${pidfile}" \ |
117 |
--background \ |
118 |
--wait ${startup_early_timeout} \ |
119 |
${tmpnice} \ |
120 |
${tmpionice} \ |
121 |
-- --defaults-file="${MY_CNF}" ${MY_ARGS} |
122 |
local ret=$? |
123 |
if [ ${ret} -ne 0 ] ; then |
124 |
eend ${ret} |
125 |
return ${ret} |
126 |
fi |
127 |
|
128 |
ewaitfile ${startup_timeout} "${socket}" |
129 |
eend $? || return 1 |
130 |
|
131 |
save_options pidfile "${pidfile}" |
132 |
save_options basedir "${basedir}" |
133 |
} |
134 |
|
135 |
stop() { |
136 |
ebegin "Stopping $(mysql_svcname)" |
137 |
|
138 |
local pidfile="$(get_options pidfile)" |
139 |
local basedir="$(get_options basedir)" |
140 |
local stop_timeout=${STOP_TIMEOUT:-120} |
141 |
|
142 |
start-stop-daemon \ |
143 |
${DEBUG/*/"--verbose"} \ |
144 |
--stop \ |
145 |
--exec "${basedir}"/sbin/mysqld \ |