ALT Linux Bugzilla
– Attachment 4052 Details for
Bug 22233
Некорректная остановка MySQL init скриптом
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
Init скрипт для MySQL с ожиданием корректного завершения mysqld
mysqld.init (text/plain), 2.67 KB, created by
Alexander S. Belov
on 2009-11-10 09:47:12 MSK
(
hide
)
Description:
Init скрипт для MySQL с ожиданием корректного завершения mysqld
Filename:
MIME Type:
Creator:
Alexander S. Belov
Created:
2009-11-10 09:47:12 MSK
Size:
2.67 KB
patch
obsolete
>#!/bin/sh ># ># chkconfig: - 80 20 ># ># description: The start/stop script for MySQL - \ ># very fast and reliable SQL database engine. ># > >WITHOUT_RC_COMPAT=1 > ># Source function library. >. /etc/init.d/functions > >ROOT=/var/lib/mysql >DATADIR=`/usr/bin/my_print_defaults mysqld |sed -ne 's/^--datadir=\(.*\)/\1/pg' |tail -1` >LOCKFILE="/var/lock/subsys/mysqld" >PIDFILE="/var/lib/mysql/mysqld.pid" >RETVAL=0 > >SourceIfNotEmpty /etc/sysconfig/mysqld > >[ -z "$OPT" ] && OPT="" > >adjust() >{ > # Initiate databases. > /usr/sbin/mysql_install_db > > action "Adjusting environment for mysqld:" /etc/chroot.d/mysql.all > RETVAL=$? > return $RETVAL >} > >charset() >{ > if [ ! -z "$CHSET" ]; then > fgrep -qs 'charset name="'$CHSET'"' /usr/share/mysql/charsets/Index.xml && return \ > || echo "Unable to find charset: $CHSET" > fi > unset LANG LANGUAGE LC_ALL > default_charset="$(HOME=/var/empty . /etc/profile.d/lang.sh && locale |sed -ne 's/^LC_COLLATE="\?[^".]\+\.\([^"]\+\)"\?$/\1/p')" > case "$default_charset" in > CP1251) > CHSET=cp1251 > ;; > KOI8-R) > CHSET=koi8r > ;; > KOI8-U) > CHSET=koi8u > ;; > UTF-8) > CHSET=utf8 > ;; > *) > echo "Unable to find proper charset from system locale, setting 'latin1'." > echo "Please edit mysqld init script and set proper charset." > CHSET=latin1 > ;; > esac >} > >stop_wait() >{ > for (( i=$1; $i>0; i=(($i-1)) )); do > start-stop-daemon --stop --name mysqld --pidfile "$PIDFILE" --user mysql --test >/dev/null 2>&1 || return > printf '%5s' "$i" > sleep 1 > printf "\b\b\b\b\b \b\b\b\b\b" > done > return 255 >} > > >start() >{ > adjust || return > charset > start_daemon --lockfile "$LOCKFILE" --pidfile "$PIDFILE" --name mysqld --expect-user mysql -- safe_mysqld -C "$CHSET" $OPT > RETVAL=$? > return $RETVAL >} > >stop() >{ > echo -n "Sending TERM signal to mysqld: " > stop_daemon --lockfile "$LOCKFILE" --pidfile "$PIDFILE" --name mysqld --expect-user mysql -TERM -- mysqld > > echo -n "Waiting, while mysqld actualy stopped:" > stop_wait 300 > RETVAL=$? > > if [ $RETVAL == 255 ]; then > echo_failure > echo > stop_daemon --lockfile "$LOCKFILE" --pidfile "$PIDFILE" --name mysqld --expect-user mysql -- mysqld > RETVAL=$? > return $RETVAL > else > echo_success > echo > return $RETVAL > fi > return $RETVAL >} > >restart() >{ > stop > start >} > ># See how we were called. >case "$1" in > start) > start > ;; > stop) > stop > ;; > restart|reload) > restart > ;; > adjust) > adjust > ;; > condstop) > if [ -e "$LOCKFILE" ]; then > stop > fi > ;; > condrestart) > if [ -e "$LOCKFILE" ]; then > restart > fi > ;; > status) > status --pidfile "$PIDFILE" --expect-user mysql mysqld > RETVAL=$? > ;; > *) > msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|adjust|status}" > RETVAL=1 >esac > >exit $RETVAL
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 22233
: 4052