You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

98 lines
3.1 KiB

#!@l_prefix@/bin/openpkg 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_common_prolog="true"
mysql_common_epilog="true"
mysql_common_numfiles="10"
mysql_common_minsize="1M"
mysql_common_complevel="9"
mysql_update_prolog="true"
mysql_update_epilog="true"
mysql_update_numfiles="10"
mysql_update_minsize="1M"
mysql_update_complevel="9"
mysql_err_prolog="true"
mysql_err_epilog="true"
mysql_err_numfiles="10"
mysql_err_minsize="1M"
mysql_err_complevel="9"
%common
mysql_pid_file=@l_prefix@/var/mysql/mysqld.pid
mysql_err_log=@l_prefix@/var/mysql/mysqld.err
mysql_common_log=@l_prefix@/var/mysql/common.log
mysql_update_log=@l_prefix@/var/mysql/update.log
mysql_flush_logs () {
HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
--defaults-extra-file=${mysql_pwd_file} \
flush-logs
}
%status -u @l_susr@ -o
mysql_usable="unknown"
mysql_active="no"
@l_prefix@/bin/mysqladmin \
--defaults-extra-file=${mysql_pwd_file} \
ping >/dev/null 2>&1 && 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
rcService mysql active 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_err_log" &
%stop -p 600 -u @l_susr@
rcService mysql enable yes || exit 0
rcService mysql active no && exit 0
mysql_flush_logs
HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
--defaults-extra-file=${mysql_pwd_file} \
shutdown
%restart -p 400 -u @l_susr@
rcService mysql enable yes || exit 0
rcService mysql active no && exit 0
rc mysql stop start
%daily -u @l_susr@
rcService mysql enable yes || exit 0
rcTmp -i
hintfile=`rcTmp -f -n hint`
shtool rotate -f \
-n ${mysql_common_numfiles} -s ${mysql_common_minsize} -d \
-z ${mysql_common_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
-P "${mysql_common_prolog}" \
-E "${mysql_common_epilog}; echo 1 >$hintfile" \
${mysql_common_log}
shtool rotate -f \
-n ${mysql_update_numfiles} -s ${mysql_update_minsize} -d \
-z ${mysql_update_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
-P "${mysql_update_prolog}" \
-E "${mysql_update_epilog}; echo 1 >$hintfile" \
${mysql_update_log}
shtool rotate -f \
-n ${mysql_err_numfiles} -s ${mysql_err_minsize} -d \
-z ${mysql_err_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
-P "${mysql_err_prolog}" \
-E "${mysql_err_epilog}; echo 1 >$hintfile" \
${mysql_err_log}
if [ -s $hintfile ]; then
mysql_flush_logs
fi
rcTmp -k