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.
69 lines
2.0 KiB
69 lines
2.0 KiB
#!@l_prefix@/bin/openpkg rc |
|
## |
|
## rc.mysql -- Run-Commands |
|
## |
|
|
|
%config |
|
mysql_enable="$openpkg_rc_def" |
|
mysql_log_prolog="true" |
|
mysql_log_epilog="true" |
|
mysql_log_numfiles="10" |
|
mysql_log_minsize="1M" |
|
mysql_log_complevel="9" |
|
|
|
%common |
|
mysql_pwd_file=@l_prefix@/etc/mysql/my.pwd |
|
mysql_cnf_file=@l_prefix@/etc/mysql/my.cnf |
|
mysql_pid_file=@l_prefix@/var/mysql/run/mysqld.pid |
|
mysql_log_log=@l_prefix@/var/mysql/log/mysqld.log |
|
mysql_admin () { |
|
HOME=@l_prefix@/etc/mysql \ |
|
@l_prefix@/bin/mysqladmin \ |
|
--defaults-extra-file=${mysql_pwd_file} \ |
|
"$@" |
|
} |
|
|
|
%status -u @l_susr@ -o |
|
mysql_usable="unknown" |
|
mysql_active="no" |
|
mysql_admin 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_susr@ |
|
rcService mysql enable yes || exit 0 |
|
rcService mysql active yes && exit 0 |
|
su @l_rusr@ -c \ |
|
"cd @l_prefix@; @l_prefix@/bin/mysqld_safe </dev/null >/dev/null 2>&1 &" \ |
|
</dev/null >/dev/null 2>&1 |
|
|
|
%stop -p 600 -u @l_susr@ |
|
rcService mysql enable yes || exit 0 |
|
rcService mysql active no && exit 0 |
|
mysql_admin flush-logs |
|
mysql_admin 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_log_numfiles} -s ${mysql_log_minsize} -d \ |
|
-z ${mysql_log_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \ |
|
-P "${mysql_log_prolog}" \ |
|
-E "${mysql_log_epilog}; echo 1 >$hintfile" \ |
|
${mysql_log_log} |
|
if [ -s $hintfile ]; then |
|
mysql_admin flush-logs |
|
fi |
|
rcTmp -k |
|
|
|
|