diff options
author | Peter Lieverdink <me@cafuego.net> | 2009-10-16 17:15:30 +1100 |
---|---|---|
committer | Peter Lieverdink <me@cafuego.net> | 2009-10-16 17:15:30 +1100 |
commit | 31ffbadb75e2408f18f4d5f4b8339e85ff0336c8 (patch) | |
tree | 2a92af269948ded5d5511fbec8293e431284f37a /support-files/mysql.server.sh | |
parent | 26c31ed688a1abb52d8a6fb40602eb2e5d3decb0 (diff) | |
download | mariadb-git-31ffbadb75e2408f18f4d5f4b8339e85ff0336c8.tar.gz |
Add `configtest' option to the init script to check for a valid my.cnf file.
Diffstat (limited to 'support-files/mysql.server.sh')
-rw-r--r-- | support-files/mysql.server.sh | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index 87198fc9cf5..fe885122e8c 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -434,9 +434,36 @@ case "$mode" in fi fi ;; - *) + 'configtest') + # Safeguard (relative paths, core dumps..) + cd $basedir + echo $echo_n "Testing MySQL configuration syntax" + daemon=$bindir/mysqld + if test -x $libexecdir/mysqld + then + daemon=$libexecdir/mysqld + elif test -x $sbindir/mysqld + then + daemon=$sbindir/mysqld + elif test -x `which mysqld` + then + daemon=`which mysqld` + else + log_failure_msg "Unable to locate the mysqld binary!" + exit 1 + fi + help_out=`$daemon --help 2>&1`; r=$? + if test "$r" != 0 ; then + log_failure_msg "$help_out" + log_failure_msg "There are syntax errors in the server configuration. Please fix them!" + else + log_success_msg "Syntax OK" + fi + exit $r + ;; + *) # usage - echo "Usage: $0 {start|stop|restart|reload|force-reload|status} [ MySQL server options ]" + echo "Usage: $0 {start|stop|restart|reload|force-reload|status|configtest} [ MySQL server options ]" exit 1 ;; esac |