Commit 2887bfbe authored by Michael Widenius's avatar Michael Widenius

Fixed lp:886484 "nowatch option for mysqld (allow systemd)"

Added a --nowatch (with aliases --no-watch and --no-auto-restart) option to mysqld_safe that causes it to exit after
spawning mysqld.  We don't need mysqld_safe to restart mysqld after a crash, because systemd can do that just fine.

Based on code from Maarten Vanraes

scripts/mysqld_safe.sh:
  Added option --nowatch (with aliases --no-watch and --no-auto-restart)
parent 3c0deee3
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
KILL_MYSQLD=1; KILL_MYSQLD=1;
MYSQLD= MYSQLD=
niceness=0 niceness=0
nowatch=0
mysqld_ld_preload= mysqld_ld_preload=
mysqld_ld_library_path= mysqld_ld_library_path=
...@@ -44,16 +45,18 @@ usage () { ...@@ -44,16 +45,18 @@ usage () {
cat <<EOF cat <<EOF
Usage: $0 [OPTIONS] Usage: $0 [OPTIONS]
--no-defaults Don't read the system defaults file --no-defaults Don't read the system defaults file
--core-file-size=LIMIT Limit core files to the specified size
--defaults-file=FILE Use the specified defaults file --defaults-file=FILE Use the specified defaults file
--defaults-extra-file=FILE Also use defaults from the specified file --defaults-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory --ledir=DIRECTORY Look for mysqld in the specified directory
--open-files-limit=LIMIT Limit the number of open files --open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
--timezone=TZ Set the system timezone --timezone=TZ Set the system timezone
--malloc-lib=LIB Preload shared library LIB if available --malloc-lib=LIB Preload shared library LIB if available
--mysqld=FILE Use the specified file as mysqld --mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld --mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
--nice=NICE Set the scheduling priority of mysqld --nice=NICE Set the scheduling priority of mysqld
--no-auto-restart Exit after starting mysqld
--nowatch Exit after starting mysqld
--plugin-dir=DIR Plugins are under DIR or DIR/VERSION, if --plugin-dir=DIR Plugins are under DIR or DIR/VERSION, if
VERSION is given VERSION is given
--skip-kill-mysqld Don't try to kill stray mysqld processes --skip-kill-mysqld Don't try to kill stray mysqld processes
...@@ -140,8 +143,16 @@ eval_log_error () { ...@@ -140,8 +143,16 @@ eval_log_error () {
;; ;;
esac esac
#echo "Running mysqld: [$cmd]" if test $nowatch -eq 1
eval "$cmd" then
# We'd prefer to exec $cmd here, but SELinux needs to be fixed first
#/usr/bin/logger "Running mysqld: $cmd"
eval "$cmd &"
exit 0
else
#echo "Running mysqld: [$cmd]"
eval "$cmd"
fi
} }
shell_quote_string() { shell_quote_string() {
...@@ -202,6 +213,7 @@ parse_arguments() { ...@@ -202,6 +213,7 @@ parse_arguments() {
fi fi
;; ;;
--nice=*) niceness="$val" ;; --nice=*) niceness="$val" ;;
--nowatch|--no-watch|--no-auto-restart) nowatch=1 ;;
--open-files-limit=*) open_files="$val" ;; --open-files-limit=*) open_files="$val" ;;
--open_files_limit=*) open_files="$val" ;; --open_files_limit=*) open_files="$val" ;;
--skip-kill-mysqld*) KILL_MYSQLD=0 ;; --skip-kill-mysqld*) KILL_MYSQLD=0 ;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment