1 |
On Mon, 06 Feb 2012 07:03:19 -0500 |
2 |
Tanstaafl <tanstaafl@×××××××××××.org> wrote: |
3 |
|
4 |
> On 2012-02-05 3:06 PM, Alan McKinnon <alan.mckinnon@×××××.com> wrote: |
5 |
> > In your shoes what I would be doing now is backup your entire mysql |
6 |
> > install (everything listed in "equery files mysql"), delete the |
7 |
> > package (emerge -C) and remerge mysql. |
8 |
> > |
9 |
> > Then check if starting and stopping works correctly. I suspect |
10 |
> > you'll find it will. Now you just need to diff these new files with |
11 |
> > your backups and find differences. |
12 |
> > |
13 |
> > Yes, this is sort of the long way round but you're not having much |
14 |
> > luck asking "anyone seen this before?", so now it's time to bring |
15 |
> > out the big guns |
16 |
> |
17 |
> Well, I'd much prefer some more basic troubleshooting first... |
18 |
> |
19 |
> I've asked for some kind soul/souls to share their init scripts so I |
20 |
> can compare - but I guess I couldg go first... here is the contents |
21 |
> of /etc/init.d/mysql: |
22 |
> |
23 |
> #!/sbin/runscript |
24 |
> # Copyright 1999-2011 Gentoo Foundation |
25 |
> # Distributed under the terms of the GNU General Public License v2 |
26 |
> # $Header: |
27 |
> /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/mysql-5.1.53-init.d,v |
28 |
> 1.1 2011/01/13 20:06:06 robbat2 Exp $ |
29 |
> |
30 |
> depend() { |
31 |
> use net.lo |
32 |
> # localmount needed for $basedir |
33 |
> need localmount |
34 |
> } |
35 |
> |
36 |
> get_config() { |
37 |
> my_print_defaults --config-file="$1" mysqld | |
38 |
> sed -n -e "s/^--$2=//p" |
39 |
> } |
40 |
> |
41 |
> mysql_svcname() { |
42 |
> local ebextra= |
43 |
> case "${SVCNAME}" in |
44 |
> mysql*) ;; |
45 |
> *) ebextra=" (mysql)" ;; |
46 |
> esac |
47 |
> echo "${SVCNAME}${ebextra}" |
48 |
> } |
49 |
> |
50 |
> start() { |
51 |
> # Check for old conf.d variables that mean migration was not |
52 |
> yet done. |
53 |
> local varlist="${!mysql_slot_*} ${!MYSQL_BLOG_PID_FILE*} |
54 |
> ${!STOPTIMEOUT*}" |
55 |
> varlist="${varlist// /}" |
56 |
> # Yes, MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING is a hidden |
57 |
> variable. # It does have a use in testing, as it is possible to build |
58 |
> a config file |
59 |
> # that works with both the old and new init scripts |
60 |
> simulateously. if [ -n "${varlist}" -a -z |
61 |
> "${MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING}" ]; then |
62 |
> eerror "You have not updated your conf.d for the new |
63 |
> mysql-init-scripts-2 revamp." |
64 |
> eerror "Not proceeding because it may be dangerous." |
65 |
> return 1 |
66 |
> fi |
67 |
> |
68 |
> # Now we can startup |
69 |
> ebegin "Starting $(mysql_svcname)" |
70 |
> |
71 |
> MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}" |
72 |
> |
73 |
> if [ ! -r "${MY_CNF}" ] ; then |
74 |
> eerror "Cannot read the configuration file |
75 |
> \`${MY_CNF}'" return 1 |
76 |
> fi |
77 |
> |
78 |
> # tail -n1 is critical as these we only want the last |
79 |
> instance of the option |
80 |
> local basedir=$(get_config "${MY_CNF}" basedir | tail -n1) |
81 |
> local datadir=$(get_config "${MY_CNF}" datadir | tail -n1) |
82 |
> local pidfile=$(get_config "${MY_CNF}" pid-file | tail -n1) |
83 |
> local socket=$(get_config "${MY_CNF}" socket | tail -n1) |
84 |
> |
85 |
> if [ ! -d "${datadir}" ] ; then |
86 |
> eerror "MySQL datadir \`${datadir}' is empty or |
87 |
> invalid" eerror "Please check your config file \`${MY_CNF}'" |
88 |
> return 1 |
89 |
> fi |
90 |
> |
91 |
> if [ ! -d "${datadir}"/mysql ] ; then |
92 |
> eerror "You don't appear to have the mysql database |
93 |
> installed yet." |
94 |
> eerror "Please run /usr/bin/mysql_install_db to have |
95 |
> this done..." |
96 |
> return 1 |
97 |
> fi |
98 |
> |
99 |
> local piddir="${pidfile%/*}" |
100 |
> if [ ! -d "$piddir" ] ; then |
101 |
> mkdir "$piddir" && \ |
102 |
> chown mysql "$piddir" |
103 |
> rc=$? |
104 |
> if [ $rc -ne 0 ]; then |
105 |
> eerror "Directory $piddir for pidfile does |
106 |
> not exist and cannot be created" |
107 |
> return 1 |
108 |
> fi |
109 |
> fi |
110 |
> |
111 |
> local startup_timeout=${STARTUP_TIMEOUT:-900} |
112 |
> local startup_early_timeout=${STARTUP_EARLY_TIMEOUT:-1000} |
113 |
> local tmpnice="${NICE:+"--nicelevel "}${NICE}" |
114 |
> local tmpionice="${IONICE:+"--ionice "}${IONICE}" |
115 |
> start-stop-daemon \ |
116 |
> ${DEBUG/*/"--verbose"} \ |
117 |
> --start \ |
118 |
> --exec "${basedir}"/sbin/mysqld \ |
119 |
> --pidfile "${pidfile}" \ |
120 |
> --background \ |
121 |
> --wait ${startup_early_timeout} \ |
122 |
> ${tmpnice} \ |
123 |
> ${tmpionice} \ |
124 |
> -- --defaults-file="${MY_CNF}" ${MY_ARGS} |
125 |
> local ret=$? |
126 |
> if [ ${ret} -ne 0 ] ; then |
127 |
> eend ${ret} |
128 |
> return ${ret} |
129 |
> fi |
130 |
> |
131 |
> ewaitfile ${startup_timeout} "${socket}" |
132 |
> eend $? || return 1 |
133 |
> |
134 |
> save_options pidfile "${pidfile}" |
135 |
> save_options basedir "${basedir}" |
136 |
> } |
137 |
> |
138 |
> stop() { |
139 |
> ebegin "Stopping $(mysql_svcname)" |
140 |
> |
141 |
> local pidfile="$(get_options pidfile)" |
142 |
> local basedir="$(get_options basedir)" |
143 |
> local stop_timeout=${STOP_TIMEOUT:-120} |
144 |
> |
145 |
> start-stop-daemon \ |
146 |
> ${DEBUG/*/"--verbose"} \ |
147 |
> --stop \ |
148 |
> --exec "${basedir}"/sbin/mysqld \ |
149 |
> |
150 |
|
151 |
FWIW, here's mine (spaced between lines of "====" to be easy to find). |
152 |
Both are largely unchanged from default: |
153 |
|
154 |
======= |
155 |
/etc/conf.d/mysql: |
156 |
# Copyright 1999-2011 Gentoo Foundation |
157 |
# Distributed under the terms of the GNU General Public License v2 |
158 |
# |
159 |
$Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/mysql-5.1.53-conf.d,v |
160 |
1.2 2011/01/15 17:54:31 robbat2 Exp $ |
161 |
|
162 |
# If you want a non-stock location for the config file, uncomment or |
163 |
update # either of these as needed. If you do use it, you must make |
164 |
sure that none of # your socket, pidfile, datadir, logfiles, binary |
165 |
logs, relay logs or InnoDB # files collide with each other. |
166 |
MY_CNF="/etc/mysql/my.cnf" |
167 |
#MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}" |
168 |
#MY_CNF="${MY_CNF:-/etc/mysql/my-${SVCNAME/mysql.}.cnf}" |
169 |
|
170 |
# Place any additional arguments here that you might need |
171 |
# Common/useful options: |
172 |
# --skip-slave-start=1 - For bringing up replication initially |
173 |
# --server-id=NNN - Server ID for replication |
174 |
# --skip-networking - lock it down to UNIX sockets only |
175 |
MY_ARGS="" |
176 |
|
177 |
# This setting (in seconds) should be high enough to allow InnoDB to do |
178 |
a full # checkpoint recovery. 900 is the default used in the upstream |
179 |
RPM startup # scripts. 30 seconds should be sufficent if you just have |
180 |
a tiny <1GiB # database. After the core startup is done, we wait this |
181 |
long for the UNIX # socket to appear. |
182 |
STARTUP_TIMEOUT="900" |
183 |
|
184 |
# This is how long, in milliseconds, we wait for pidfile to be created, |
185 |
early # in the startup. |
186 |
STARTUP_EARLY_TIMEOUT="1000" |
187 |
|
188 |
# How long (in seconds) should we wait for shutdown? |
189 |
STOP_TIMEOUT=120 |
190 |
|
191 |
# integer [-20 .. 19 ] default 0 |
192 |
# change the priority of the server -20 (high) to 19 (low) |
193 |
# see nice(1) for description |
194 |
#NICE=0 |
195 |
|
196 |
# See start-stop-daemon(8) for possible settings |
197 |
#IONICE=2 |
198 |
|
199 |
# If defined, --verbose gets passed to S-S-D |
200 |
#DEBUG=1 |
201 |
|
202 |
# Depending on your usage of MySQL, you may also wish to start it after |
203 |
some # other services are up. Uncomment the lines below as needed. If |
204 |
these aren't # enough for you, we encourage you to file a bug, and help |
205 |
us understand how # you are using MySQL. |
206 |
|
207 |
# Do your MySQL ACLs refer to hostnames not in your /etc/hosts? |
208 |
# If so, you need DNS before you can accept connections. |
209 |
# Avoid dependency circular loops if you use MySQL to power a local DNS |
210 |
server. #rc_use="dns" |
211 |
#rc_after="dns" |
212 |
|
213 |
# Does your MySQL bind to an IP on an interface other than net.lo? |
214 |
# Alternatively you might wish to specify the exact interface here. |
215 |
#rc_use="net" |
216 |
#rc_after="net" |
217 |
|
218 |
# Do you store your MySQL files on a SAN or other network filesystem, |
219 |
that is # provided by the netmount init script? |
220 |
#rc_need="netmount" |
221 |
|
222 |
# Or from NFS? P.S. This is not a good idea in most cases, but does |
223 |
have some # valid usage cases, so we provide the option. |
224 |
#rc_need="nfsmount" |
225 |
|
226 |
# Should any one of the instances satisfy the requirement for MySQL |
227 |
coming up? # By default, we say no. |
228 |
[ "${SVCNAME}" != mysql ] && rc_provide="!mysql" |
229 |
# But uncomment this next instead if you think it should. |
230 |
#rc_provide="mysql" |
231 |
|
232 |
# The conditional above has a false-positive "failure" return value as a |
233 |
# side-effect, and since it's the last statement, without the next |
234 |
line, this # script returns failure. |
235 |
return 0 |
236 |
# vim: ft=gentoo-conf-d et ts=4 sw=4: |
237 |
======= |
238 |
|
239 |
======= |
240 |
/etc/init.smysql: |
241 |
#!/sbin/runscript |
242 |
# Copyright 1999-2011 Gentoo Foundation |
243 |
# Distributed under the terms of the GNU General Public License v2 |
244 |
# |
245 |
$Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/mysql-5.1.53-init.d,v |
246 |
1.1 2011/01/13 20:06:06 robbat2 Exp $ |
247 |
|
248 |
depend() { |
249 |
use net.lo |
250 |
# localmount needed for $basedir |
251 |
need localmount |
252 |
} |
253 |
|
254 |
get_config() { |
255 |
my_print_defaults --config-file="$1" mysqld | |
256 |
sed -n -e "s/^--$2=//p" |
257 |
} |
258 |
|
259 |
mysql_svcname() { |
260 |
local ebextra= |
261 |
case "${SVCNAME}" in |
262 |
mysql*) ;; |
263 |
*) ebextra=" (mysql)" ;; |
264 |
esac |
265 |
echo "${SVCNAME}${ebextra}" |
266 |
} |
267 |
|
268 |
start() { |
269 |
# Check for old conf.d variables that mean migration was not |
270 |
yet done. local varlist="${!mysql_slot_*} ${!MYSQL_BLOG_PID_FILE*} |
271 |
${!STOPTIMEOUT*}" varlist="${varlist// /}" |
272 |
# Yes, MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING is a hidden variable. |
273 |
# It does have a use in testing, as it is possible to build a |
274 |
config file # that works with both the old and new init scripts |
275 |
simulateously. if [ -n "${varlist}" -a -z |
276 |
"${MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING}" ]; then eerror "You have not |
277 |
updated your conf.d for the new mysql-init-scripts-2 revamp." eerror |
278 |
"Not proceeding because it may be dangerous." return 1 |
279 |
fi |
280 |
|
281 |
# Now we can startup |
282 |
ebegin "Starting $(mysql_svcname)" |
283 |
|
284 |
MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}" |
285 |
|
286 |
if [ ! -r "${MY_CNF}" ] ; then |
287 |
eerror "Cannot read the configuration file \`${MY_CNF}'" |
288 |
return 1 |
289 |
fi |
290 |
|
291 |
# tail -n1 is critical as these we only want the last instance |
292 |
of the option local basedir=$(get_config "${MY_CNF}" basedir | |
293 |
tail -n1) local datadir=$(get_config "${MY_CNF}" datadir | tail |
294 |
-n1) local pidfile=$(get_config "${MY_CNF}" pid-file | tail -n1) |
295 |
local socket=$(get_config "${MY_CNF}" socket | tail -n1) |
296 |
|
297 |
if [ ! -d "${datadir}" ] ; then |
298 |
eerror "MySQL datadir \`${datadir}' is empty or invalid" |
299 |
eerror "Please check your config file \`${MY_CNF}'" |
300 |
return 1 |
301 |
fi |
302 |
|
303 |
if [ ! -d "${datadir}"/mysql ] ; then |
304 |
eerror "You don't appear to have the mysql database |
305 |
installed yet." eerror "Please run /usr/bin/mysql_install_db to |
306 |
have this done..." return 1 |
307 |
fi |
308 |
|
309 |
local piddir="${pidfile%/*}" |
310 |
if [ ! -d "$piddir" ] ; then |
311 |
mkdir "$piddir" && \ |
312 |
chown mysql "$piddir" |
313 |
rc=$? |
314 |
if [ $rc -ne 0 ]; then |
315 |
eerror "Directory $piddir for pidfile does not |
316 |
exist and cannot be created" return 1 |
317 |
fi |
318 |
fi |
319 |
|
320 |
local startup_timeout=${STARTUP_TIMEOUT:-900} |
321 |
local startup_early_timeout=${STARTUP_EARLY_TIMEOUT:-1000} |
322 |
local tmpnice="${NICE:+"--nicelevel "}${NICE}" |
323 |
local tmpionice="${IONICE:+"--ionice "}${IONICE}" |
324 |
start-stop-daemon \ |
325 |
${DEBUG/*/"--verbose"} \ |
326 |
--start \ |
327 |
--exec "${basedir}"/sbin/mysqld \ |
328 |
--pidfile "${pidfile}" \ |
329 |
--background \ |
330 |
--wait ${startup_early_timeout} \ |
331 |
${tmpnice} \ |
332 |
${tmpionice} \ |
333 |
-- --defaults-file="${MY_CNF}" ${MY_ARGS} |
334 |
local ret=$? |
335 |
if [ ${ret} -ne 0 ] ; then |
336 |
eend ${ret} |
337 |
return ${ret} |
338 |
fi |
339 |
|
340 |
ewaitfile ${startup_timeout} "${socket}" |
341 |
eend $? || return 1 |
342 |
|
343 |
save_options pidfile "${pidfile}" |
344 |
save_options basedir "${basedir}" |
345 |
} |
346 |
|
347 |
stop() { |
348 |
ebegin "Stopping $(mysql_svcname)" |
349 |
|
350 |
local pidfile="$(get_options pidfile)" |
351 |
local basedir="$(get_options basedir)" |
352 |
local stop_timeout=${STOP_TIMEOUT:-120} |
353 |
|
354 |
start-stop-daemon \ |
355 |
${DEBUG/*/"--verbose"} \ |
356 |
--stop \ |
357 |
--exec "${basedir}"/sbin/mysqld \ |
358 |
--pidfile "${pidfile}" \ |
359 |
--retry ${stop_timeout} |
360 |
eend $? |
361 |
} |
362 |
# vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet: |
363 |
======= |
364 |
|
365 |
-- |
366 |
Alan McKinnnon |
367 |
alan.mckinnon@×××××.com |