diff options
Diffstat (limited to 'packaging/rpm-oel/mysql.init')
-rw-r--r-- | packaging/rpm-oel/mysql.init | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/packaging/rpm-oel/mysql.init b/packaging/rpm-oel/mysql.init index 79c8a8daa7d..56dee65888f 100644 --- a/packaging/rpm-oel/mysql.init +++ b/packaging/rpm-oel/mysql.init @@ -23,31 +23,37 @@ prog="mysqld" STARTTIMEOUT=120 STOPTIMEOUT=60 +# Set in /etc/sysconfig/mysqld, will be passed to mysqld_safe +MYSQLD_OPTS= + [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog lockfile=/var/lock/subsys/$prog -# extract value of a MySQL option from config files -# Usage: get_mysql_option SECTION VARNAME DEFAULT -# result is returned in $result +# Extract value of a MySQL option from config files +# Usage: get_mysql_option OPTION DEFAULT SECTION1 SECTION2 SECTIONN +# Result is returned in $result # We use my_print_defaults which prints all options from multiple files, # with the more specific ones later; hence take the last match. -get_mysql_option(){ - result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1` - if [ -z "$result" ]; then - # not found, use default - result="$3" - fi +get_mysql_option () { + option=$1 + default=$2 + shift 2 + result=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1) + if [ -z "$result" ]; then + # not found, use default + result="${default}" + fi } -get_mysql_option mysqld datadir "/var/lib/mysql" +get_mysql_option datadir "/var/lib/mysql" mysqld datadir="$result" -get_mysql_option mysqld socket "$datadir/mysql.sock" +get_mysql_option socket "$datadir/mysql.sock" mysqld socketfile="$result" -get_mysql_option mysqld_safe log-error "/var/log/mysqld.log" +get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe errlogfile="$result" -get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid" +get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe mypidfile="$result" case $socketfile in @@ -100,7 +106,7 @@ start(){ # and some users might prefer to configure logging to syslog.) # Note: set --basedir to prevent probes that might trigger SELinux # alarms, per bug #547485 - $exec --datadir="$datadir" --socket="$socketfile" \ + $exec $MYSQLD_OPTS --datadir="$datadir" --socket="$socketfile" \ --pid-file="$mypidfile" \ --basedir=/usr --user=mysql >/dev/null 2>&1 & safe_pid=$! |