mysql/rc.mysql

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 #!@l_prefix@/bin/openpkg rc
     2 ##
     3 ##  rc.mysql -- Run-Commands
     4 ##
     6 %config
     7     mysql_enable="$openpkg_rc_def"
     8     mysql_pwd_file=@l_prefix@/etc/mysql/my.pwd
     9     mysql_cnf_file=@l_prefix@/etc/mysql/my.cnf
    10     mysql_common_prolog="true"
    11     mysql_common_epilog="true"
    12     mysql_common_numfiles="10"
    13     mysql_common_minsize="1M"
    14     mysql_common_complevel="9"
    15     mysql_err_prolog="true"
    16     mysql_err_epilog="true"
    17     mysql_err_numfiles="10"
    18     mysql_err_minsize="1M"
    19     mysql_err_complevel="9"
    21 %common
    22     mysql_pid_file=@l_prefix@/var/mysql/mysqld.pid
    23     mysql_err_log=@l_prefix@/var/mysql/mysqld.err
    24     mysql_common_log=@l_prefix@/var/mysql/common.log
    25     mysql_flush_logs () {
    26         HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
    27             --defaults-extra-file=${mysql_pwd_file} \
    28             flush-logs
    29     }
    31 %status -u @l_susr@ -o
    32     mysql_usable="unknown"
    33     mysql_active="no"
    34     HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
    35         --defaults-extra-file=${mysql_pwd_file} \
    36         ping >/dev/null 2>&1 && mysql_active="yes"
    37     if [ $mysql_active = "no" -a -f $mysql_pid_file ] ; then
    38         kill -0 `cat $mysql_pid_file` && mysql_active="unknown"
    39     fi
    40     echo "mysql_enable=\"$mysql_enable\""
    41     echo "mysql_usable=\"$mysql_usable\""
    42     echo "mysql_active=\"$mysql_active\""
    44 %start -p 400 -u @l_susr@
    45     rcService mysql enable yes || exit 0
    46     rcService mysql active yes && exit 0
    47     cd @l_prefix@
    48     cmd="@l_prefix@/bin/mysqld_safe"
    49     cmd="$cmd --pid-file=$mysql_pid_file"
    50     cmd="$cmd --log-error=$mysql_err_log"
    51     su @l_rusr@ -c "$cmd </dev/null >/dev/null 2>&1 &" </dev/null >/dev/null 2>&1
    53 %stop -p 600 -u @l_susr@
    54     rcService mysql enable yes || exit 0
    55     rcService mysql active no  && exit 0
    56     mysql_flush_logs
    57     HOME=@l_prefix@/etc/mysql @l_prefix@/bin/mysqladmin \
    58         --defaults-extra-file=${mysql_pwd_file} \
    59         shutdown
    61 %restart -p 400 -u @l_susr@
    62     rcService mysql enable yes || exit 0
    63     rcService mysql active no  && exit 0
    64     rc mysql stop start
    66 %daily -u @l_susr@
    67     rcService mysql enable yes || exit 0
    68     rcTmp -i
    69     hintfile=`rcTmp -f -n hint`
    70     shtool rotate -f \
    71         -n ${mysql_common_numfiles} -s ${mysql_common_minsize} -d \
    72         -z ${mysql_common_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
    73         -P "${mysql_common_prolog}" \
    74         -E "${mysql_common_epilog}; echo 1 >$hintfile" \
    75         ${mysql_common_log}
    76     shtool rotate -f \
    77         -n ${mysql_err_numfiles} -s ${mysql_err_minsize} -d \
    78         -z ${mysql_err_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
    79         -P "${mysql_err_prolog}" \
    80         -E "${mysql_err_epilog}; echo 1 >$hintfile" \
    81         ${mysql_err_log}
    82     if [ -s $hintfile ]; then
    83         mysql_flush_logs
    84     fi
    85     rcTmp -k

mercurial