1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mysql/rc.mysql Tue Aug 28 18:28:40 2012 +0200 1.3 @@ -0,0 +1,86 @@ 1.4 +#!@l_prefix@/bin/openpkg rc 1.5 +## 1.6 +## rc.mysql -- Run-Commands 1.7 +## 1.8 + 1.9 +%config 1.10 + mysql_enable="$openpkg_rc_def" 1.11 + mysql_pwd_file=@l_prefix@/etc/mysql/my.pwd 1.12 + mysql_cnf_file=@l_prefix@/etc/mysql/my.cnf 1.13 + mysql_common_prolog="true" 1.14 + mysql_common_epilog="true" 1.15 + mysql_common_numfiles="10" 1.16 + mysql_common_minsize="1M" 1.17 + mysql_common_complevel="9" 1.18 + mysql_err_prolog="true" 1.19 + mysql_err_epilog="true" 1.20 + mysql_err_numfiles="10" 1.21 + mysql_err_minsize="1M" 1.22 + mysql_err_complevel="9" 1.23 + 1.24 +%common 1.25 + mysql_pid_file=@l_prefix@/var/mysql/mysqld.pid 1.26 + mysql_err_log=@l_prefix@/var/mysql/mysqld.err 1.27 + mysql_common_log=@l_prefix@/var/mysql/common.log 1.28 + mysql_flush_logs () { 1.29 + HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \ 1.30 + --defaults-extra-file=${mysql_pwd_file} \ 1.31 + flush-logs 1.32 + } 1.33 + 1.34 +%status -u @l_susr@ -o 1.35 + mysql_usable="unknown" 1.36 + mysql_active="no" 1.37 + HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \ 1.38 + --defaults-extra-file=${mysql_pwd_file} \ 1.39 + ping >/dev/null 2>&1 && mysql_active="yes" 1.40 + if [ $mysql_active = "no" -a -f $mysql_pid_file ] ; then 1.41 + kill -0 `cat $mysql_pid_file` && mysql_active="unknown" 1.42 + fi 1.43 + echo "mysql_enable=\"$mysql_enable\"" 1.44 + echo "mysql_usable=\"$mysql_usable\"" 1.45 + echo "mysql_active=\"$mysql_active\"" 1.46 + 1.47 +%start -p 400 -u @l_susr@ 1.48 + rcService mysql enable yes || exit 0 1.49 + rcService mysql active yes && exit 0 1.50 + cd @l_prefix@ 1.51 + cmd="@l_prefix@/bin/mysqld_safe" 1.52 + cmd="$cmd --pid-file=$mysql_pid_file" 1.53 + cmd="$cmd --log-error=$mysql_err_log" 1.54 + su @l_rusr@ -c "$cmd </dev/null >/dev/null 2>&1 &" </dev/null >/dev/null 2>&1 1.55 + 1.56 +%stop -p 600 -u @l_susr@ 1.57 + rcService mysql enable yes || exit 0 1.58 + rcService mysql active no && exit 0 1.59 + mysql_flush_logs 1.60 + HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \ 1.61 + --defaults-extra-file=${mysql_pwd_file} \ 1.62 + shutdown 1.63 + 1.64 +%restart -p 400 -u @l_susr@ 1.65 + rcService mysql enable yes || exit 0 1.66 + rcService mysql active no && exit 0 1.67 + rc mysql stop start 1.68 + 1.69 +%daily -u @l_susr@ 1.70 + rcService mysql enable yes || exit 0 1.71 + rcTmp -i 1.72 + hintfile=`rcTmp -f -n hint` 1.73 + shtool rotate -f \ 1.74 + -n ${mysql_common_numfiles} -s ${mysql_common_minsize} -d \ 1.75 + -z ${mysql_common_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \ 1.76 + -P "${mysql_common_prolog}" \ 1.77 + -E "${mysql_common_epilog}; echo 1 >$hintfile" \ 1.78 + ${mysql_common_log} 1.79 + shtool rotate -f \ 1.80 + -n ${mysql_err_numfiles} -s ${mysql_err_minsize} -d \ 1.81 + -z ${mysql_err_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \ 1.82 + -P "${mysql_err_prolog}" \ 1.83 + -E "${mysql_err_epilog}; echo 1 >$hintfile" \ 1.84 + ${mysql_err_log} 1.85 + if [ -s $hintfile ]; then 1.86 + mysql_flush_logs 1.87 + fi 1.88 + rcTmp -k 1.89 +