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 @@
KILL_MYSQLD=1;
MYSQLD=
niceness=0
nowatch=0
mysqld_ld_preload=
mysqld_ld_library_path=
......@@ -44,16 +45,18 @@ usage () {
cat <<EOF
Usage: $0 [OPTIONS]
--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-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory
--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
--malloc-lib=LIB Preload shared library LIB if available
--mysqld=FILE Use the specified file as mysqld
--mysqld-version=VERSION Use "mysqld-VERSION" as 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
VERSION is given
--skip-kill-mysqld Don't try to kill stray mysqld processes
......@@ -140,8 +143,16 @@ eval_log_error () {
;;
esac
#echo "Running mysqld: [$cmd]"
eval "$cmd"
if test $nowatch -eq 1
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() {
......@@ -202,6 +213,7 @@ parse_arguments() {
fi
;;
--nice=*) niceness="$val" ;;
--nowatch|--no-watch|--no-auto-restart) nowatch=1 ;;
--open-files-limit=*) open_files="$val" ;;
--open_files_limit=*) open_files="$val" ;;
--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