|
|
|
|
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
|
|
|
|
|
##
|
|
|
|
|
## rc.mysql3 -- Run-Commands
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
%config
|
|
|
|
|
mysql3_enable="$openpkg_rc_def"
|
|
|
|
|
mysql3_pwd_file=@l_prefix@/etc/mysql/my.pwd
|
|
|
|
|
mysql3_cnf_file=@l_prefix@/etc/mysql/my.cnf
|
|
|
|
|
mysql3_common_prolog="true"
|
|
|
|
|
mysql3_common_epilog="true"
|
|
|
|
|
mysql3_common_numfiles="10"
|
|
|
|
|
mysql3_common_minsize="1M"
|
|
|
|
|
mysql3_common_complevel="9"
|
|
|
|
|
mysql3_update_prolog="true"
|
|
|
|
|
mysql3_update_epilog="true"
|
|
|
|
|
mysql3_update_numfiles="10"
|
|
|
|
|
mysql3_update_minsize="1M"
|
|
|
|
|
mysql3_update_complevel="9"
|
|
|
|
|
mysql3_err_prolog="true"
|
|
|
|
|
mysql3_err_epilog="true"
|
|
|
|
|
mysql3_err_numfiles="10"
|
|
|
|
|
mysql3_err_minsize="1M"
|
|
|
|
|
mysql3_err_complevel="9"
|
|
|
|
|
|
|
|
|
|
%common
|
|
|
|
|
# same paths as in my.cnf
|
|
|
|
|
mysql3_pid_file=@l_prefix@/var/mysql/mysqld.pid
|
|
|
|
|
mysql3_log_err=@l_prefix@/var/mysql/mysqld.err
|
|
|
|
|
mysql3_log_common=@l_prefix@/var/mysql/common.log
|
|
|
|
|
mysql3_log_update=@l_prefix@/var/mysql/update.log
|
|
|
|
|
|
|
|
|
|
%status -u @l_rusr@ -o
|
|
|
|
|
mysql3_usable="unknown"
|
|
|
|
|
mysql3_active="no"
|
|
|
|
|
@l_prefix@/bin/mysql3admin \
|
|
|
|
|
--defaults-extra-file=${mysql3_pwd_file} \
|
|
|
|
|
ping >/dev/null 2>&1 && mysql3_active="yes"
|
|
|
|
|
if [ $mysql3_active = "no" -a -f $mysql3_pid_file ] ; then
|
|
|
|
|
kill -0 `cat $mysql3_pid_file` && mysql3_active="unknown"
|
|
|
|
|
fi
|
|
|
|
|
echo "mysql3_enable=\"$mysql3_enable\""
|
|
|
|
|
echo "mysql3_usable=\"$mysql3_usable\""
|
|
|
|
|
echo "mysql3_active=\"$mysql3_active\""
|
|
|
|
|
|
|
|
|
|
%start -p 400 -u @l_rusr@
|
|
|
|
|
rcService mysql3 enable yes || exit 0
|
|
|
|
|
rcService mysql3 active yes && exit 0
|
|
|
|
|
cd @l_prefix@
|
|
|
|
|
@l_prefix@/bin/safe_mysqld >/dev/null 2>&1 \
|
|
|
|
|
--mysqld=@l_mysqld@ \
|
|
|
|
|
--pid-file="$mysql3_pid_file" \
|
|
|
|
|
--err-log="$mysql3_log_err" &
|
|
|
|
|
|
|
|
|
|
%stop -p 400 -u @l_rusr@
|
|
|
|
|
rcService mysql3 enable yes || exit 0
|
|
|
|
|
rcService mysql3 active no && exit 0
|
|
|
|
|
@l_prefix@/bin/mysqladmin \
|
|
|
|
|
--defaults-extra-file=${mysql3_pwd_file} \
|
|
|
|
|
flush-logs
|
|
|
|
|
@l_prefix@/bin/mysqladmin \
|
|
|
|
|
--defaults-extra-file=${mysql3_pwd_file} \
|
|
|
|
|
shutdown
|
|
|
|
|
|
|
|
|
|
%restart -p 400 -u @l_rusr@
|
|
|
|
|
rcService mysql3 enable yes || exit 0
|
|
|
|
|
rcService mysql3 active no && exit 0
|
|
|
|
|
rc mysql3 stop start
|
|
|
|
|
|
|
|
|
|
%daily -u @l_susr@
|
|
|
|
|
rcService mysql3 enable yes || exit 0
|
|
|
|
|
|
|
|
|
|
# rotate logfiles
|
|
|
|
|
rcTmp -i
|
|
|
|
|
hintfile=`rcTmp -f -n hint`
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${mysql3_common_numfiles} -s ${mysql3_common_minsize} -d \
|
|
|
|
|
-z ${mysql3_common_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
|
|
|
|
|
-P "${mysql3_common_prolog}" \
|
|
|
|
|
-E "${mysql3_common_epilog} && echo 1 >$hintfile" \
|
|
|
|
|
${mysql3_common_log}
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${mysql3_update_numfiles} -s ${mysql3_update_minsize} -d \
|
|
|
|
|
-z ${mysql3_update_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
|
|
|
|
|
-P "${mysql3_update_prolog}" \
|
|
|
|
|
-E "${mysql3_update_epilog} && echo 1 >$hintfile" \
|
|
|
|
|
${mysql3_update_log}
|
|
|
|
|
shtool rotate -f \
|
|
|
|
|
-n ${mysql3_err_numfiles} -s ${mysql3_err_minsize} -d \
|
|
|
|
|
-z ${mysql3_err_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
|
|
|
|
|
-P "${mysql3_err_prolog}" \
|
|
|
|
|
-E "${mysql3_err_epilog} && echo 1 >$hintfile" \
|
|
|
|
|
${mysql3_err_log}
|
|
|
|
|
if [ -s $hintfile ]; then
|
|
|
|
|
rc mysql3 restart
|
|
|
|
|
fi
|
|
|
|
|
rcTmp -k
|
|
|
|
|
|