|
|
|
|
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
|
|
|
|
|
##
|
|
|
|
|
## rc.mysql -- Run-Commands
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
%config
|
|
|
|
|
mysql_enable="$openpkg_rc_def"
|
|
|
|
|
mysql_pwd_file=@l_prefix@/etc/mysql/my.pwd
|
|
|
|
|
mysql_cnf_file=@l_prefix@/etc/mysql/my.cnf
|
|
|
|
|
mysql_log_prolog="true"
|
|
|
|
|
mysql_log_epilog="true"
|
|
|
|
|
mysql_log_numfiles="10"
|
|
|
|
|
mysql_log_minsize="1M"
|
|
|
|
|
mysql_log_complevel="9"
|
|
|
|
|
|
|
|
|
|
%common
|
|
|
|
|
# same paths as in my.cnf
|
|
|
|
|
mysql_pid_file=@l_prefix@/var/mysql/mysqld.pid
|
|
|
|
|
mysql_log_err=@l_prefix@/var/mysql/mysqld.err
|
|
|
|
|
mysql_log_common=@l_prefix@/var/mysql/common.log
|
|
|
|
|
mysql_log_update=@l_prefix@/var/mysql/update.log
|
|
|
|
|
|
|
|
|
|
%status -u @l_susr@ -o
|
|
|
|
|
mysql_usable="unknown"
|
|
|
|
|
mysql_active="no"
|
|
|
|
|
@l_prefix@/bin/mysqladmin \
|
|
|
|
|
--defaults-extra-file=${mysql_pwd_file} \
|
|
|
|
|
ping 2>/dev/null && mysql_active="yes"
|
|
|
|
|
if [ $mysql_active = "no" -a -f $mysql_pid_file ] ; then
|
|
|
|
|
kill -0 `cat $mysql_pid_file` && mysql_active="unknown"
|
|
|
|
|
fi
|
|
|
|
|
echo "mysql_enable=\"$mysql_enable\""
|
|
|
|
|
echo "mysql_usable=\"$mysql_usable\""
|
|
|
|
|
echo "mysql_active=\"$mysql_active\""
|
|
|
|
|
|
|
|
|
|
%start -p 400 -u @l_rusr@
|
|
|
|
|
rcService mysql enable yes || exit 0
|
|
|
|
|
cd @l_prefix@
|
|
|
|
|
@l_prefix@/bin/mysqld_safe >/dev/null 2>&1 \
|
|
|
|
|
--mysqld=@l_mysqld@ \
|
|
|
|
|
--pid-file="$mysql_pid_file" \
|
|
|
|
|
--err-log="$mysql_log_err" &
|
|
|
|
|
|
|
|
|
|
%stop -p 400 -u @l_rusr@
|
|
|
|
|
rcService mysql enable yes || exit 0
|
|
|
|
|
@l_prefix@/bin/mysqladmin \
|
|
|
|
|
--defaults-extra-file=${mysql_pwd_file} \
|
|
|
|
|
shutdown
|
|
|
|
|
|
|
|
|
|
%restart -p 400 -u @l_rusr@
|
|
|
|
|
rcService mysql enable yes || exit 0
|
|
|
|
|
cd @l_prefix@
|
|
|
|
|
@l_prefix@/bin/mysqladmin \
|
|
|
|
|
--defaults-extra-file=${mysql_pwd_file} \
|
|
|
|
|
shutdown
|
|
|
|
|
@l_prefix@/bin/mysqld_safe >/dev/null 2>&1 \
|
|
|
|
|
--mysqld=@l_mysqld@ \
|
|
|
|
|
--pid-file="$mysql_pid_file" \
|
|
|
|
|
--err-log="$mysql_log_err" &
|
|
|
|
|
|
|
|
|
|
%daily -u @l_rusr@
|
|
|
|
|
rcService mysql enable yes || exit 0
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${mysql_log_numfiles} -s ${mysql_log_minsize} -d \
|
|
|
|
|
-z ${mysql_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
|
|
|
|
|
-P "${mysql_log_prolog}" \
|
|
|
|
|
-E "@l_prefix@/bin/mysqladmin \
|
|
|
|
|
--defaults-extra-file=${mysql_pwd_file} \
|
|
|
|
|
flush-logs; ${mysql_log_epilog}" \
|
|
|
|
|
${mysql_log_common} \
|
|
|
|
|
${mysql_log_update} \
|
|
|
|
|
${mysql_log_err}
|
|
|
|
|
|