michael@527: #!@l_prefix@/bin/openpkg rc michael@527: ## michael@527: ## rc.mysql -- Run-Commands michael@527: ## michael@527: michael@527: %config michael@527: mysql_enable="$openpkg_rc_def" michael@527: mysql_pwd_file=@l_prefix@/etc/mysql/my.pwd michael@527: mysql_cnf_file=@l_prefix@/etc/mysql/my.cnf michael@527: mysql_common_prolog="true" michael@527: mysql_common_epilog="true" michael@527: mysql_common_numfiles="10" michael@527: mysql_common_minsize="1M" michael@527: mysql_common_complevel="9" michael@527: mysql_err_prolog="true" michael@527: mysql_err_epilog="true" michael@527: mysql_err_numfiles="10" michael@527: mysql_err_minsize="1M" michael@527: mysql_err_complevel="9" michael@527: michael@527: %common michael@527: mysql_pid_file=@l_prefix@/var/mysql/mysqld.pid michael@527: mysql_err_log=@l_prefix@/var/mysql/mysqld.err michael@527: mysql_common_log=@l_prefix@/var/mysql/common.log michael@527: mysql_flush_logs () { michael@527: HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \ michael@527: --defaults-extra-file=${mysql_pwd_file} \ michael@527: flush-logs michael@527: } michael@527: michael@527: %status -u @l_susr@ -o michael@527: mysql_usable="unknown" michael@527: mysql_active="no" michael@527: HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \ michael@527: --defaults-extra-file=${mysql_pwd_file} \ michael@527: ping >/dev/null 2>&1 && mysql_active="yes" michael@527: if [ $mysql_active = "no" -a -f $mysql_pid_file ] ; then michael@527: kill -0 `cat $mysql_pid_file` && mysql_active="unknown" michael@527: fi michael@527: echo "mysql_enable=\"$mysql_enable\"" michael@527: echo "mysql_usable=\"$mysql_usable\"" michael@527: echo "mysql_active=\"$mysql_active\"" michael@527: michael@527: %start -p 400 -u @l_susr@ michael@527: rcService mysql enable yes || exit 0 michael@527: rcService mysql active yes && exit 0 michael@527: cd @l_prefix@ michael@527: cmd="@l_prefix@/bin/mysqld_safe" michael@527: cmd="$cmd --pid-file=$mysql_pid_file" michael@527: cmd="$cmd --log-error=$mysql_err_log" michael@527: su @l_rusr@ -c "$cmd /dev/null 2>&1 &" /dev/null 2>&1 michael@527: michael@527: %stop -p 600 -u @l_susr@ michael@527: rcService mysql enable yes || exit 0 michael@527: rcService mysql active no && exit 0 michael@527: mysql_flush_logs michael@527: HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \ michael@527: --defaults-extra-file=${mysql_pwd_file} \ michael@527: shutdown michael@527: michael@527: %restart -p 400 -u @l_susr@ michael@527: rcService mysql enable yes || exit 0 michael@527: rcService mysql active no && exit 0 michael@527: rc mysql stop start michael@527: michael@527: %daily -u @l_susr@ michael@527: rcService mysql enable yes || exit 0 michael@527: rcTmp -i michael@527: hintfile=`rcTmp -f -n hint` michael@527: shtool rotate -f \ michael@527: -n ${mysql_common_numfiles} -s ${mysql_common_minsize} -d \ michael@527: -z ${mysql_common_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \ michael@527: -P "${mysql_common_prolog}" \ michael@527: -E "${mysql_common_epilog}; echo 1 >$hintfile" \ michael@527: ${mysql_common_log} michael@527: shtool rotate -f \ michael@527: -n ${mysql_err_numfiles} -s ${mysql_err_minsize} -d \ michael@527: -z ${mysql_err_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \ michael@527: -P "${mysql_err_prolog}" \ michael@527: -E "${mysql_err_epilog}; echo 1 >$hintfile" \ michael@527: ${mysql_err_log} michael@527: if [ -s $hintfile ]; then michael@527: mysql_flush_logs michael@527: fi michael@527: rcTmp -k michael@527: