Commit 52139e25 authored by greg@mysql.com's avatar greg@mysql.com

Merge gweir@bk-internal.mysql.com:/home/bk/mysql-4.0

into mysql.com:/home/greg/bk/mysql-4.0
parents 62538891 c086252a
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
******************************************************************************/ ******************************************************************************/
char autoclose; char autoclose;
char basedir[PATH_MAX]; char basedir[PATH_MAX];
char checktables;
char datadir[PATH_MAX]; char datadir[PATH_MAX];
char pid_file[PATH_MAX]; char pid_file[PATH_MAX];
char address[PATH_MAX]; char address[PATH_MAX];
...@@ -54,6 +55,7 @@ FILE *log_fd = NULL; ...@@ -54,6 +55,7 @@ FILE *log_fd = NULL;
******************************************************************************/ ******************************************************************************/
void usage(void);
void vlog(char *, va_list); void vlog(char *, va_list);
void log(char *, ...); void log(char *, ...);
void start_defaults(int, char*[]); void start_defaults(int, char*[]);
...@@ -72,6 +74,42 @@ void mysql_start(int, char*[]); ...@@ -72,6 +74,42 @@ void mysql_start(int, char*[]);
******************************************************************************/ ******************************************************************************/
/******************************************************************************
usage()
Show usage.
******************************************************************************/
void usage(void)
{
// keep the screen up
setscreenmode(SCR_NO_MODE);
puts("\
\n\
usage: mysqld_safe [options]\n\
\n\
Program to start the MySQL daemon and restart it if it dies unexpectedly.\n\
All options, besides those listed below, are passed on to the MySQL daemon.\n\
\n\
options:\n\
\n\
--autoclose Automatically close the mysqld_safe screen.\n\
\n\
--check-tables Check the tables before starting the MySQL daemon.\n\
\n\
--err-log=<file> Send the MySQL daemon error output to <file>.\n\
\n\
--help Show this help information.\n\
\n\
--mysqld=<file> Use the <file> MySQL daemon.\n\
\n\
");
exit(-1);
}
/****************************************************************************** /******************************************************************************
vlog() vlog()
...@@ -136,6 +174,9 @@ void start_defaults(int argc, char *argv[]) ...@@ -136,6 +174,9 @@ void start_defaults(int argc, char *argv[])
// basedir // basedir
get_basedir(argv[0], basedir); get_basedir(argv[0], basedir);
// check-tables
checktables = FALSE;
// hostname // hostname
if (gethostname(hostname,PATH_MAX) < 0) if (gethostname(hostname,PATH_MAX) < 0)
{ {
...@@ -279,13 +320,15 @@ void parse_args(int argc, char *argv[]) ...@@ -279,13 +320,15 @@ void parse_args(int argc, char *argv[])
OPT_PORT, OPT_PORT,
OPT_ERR_LOG, OPT_ERR_LOG,
OPT_SAFE_LOG, OPT_SAFE_LOG,
OPT_MYSQLD OPT_MYSQLD,
OPT_HELP
}; };
static struct option options[] = static struct option options[] =
{ {
{"autoclose", no_argument, &autoclose, TRUE}, {"autoclose", no_argument, &autoclose, TRUE},
{"basedir", required_argument, 0, OPT_BASEDIR}, {"basedir", required_argument, 0, OPT_BASEDIR},
{"check-tables", no_argument, &checktables, TRUE},
{"datadir", required_argument, 0, OPT_DATADIR}, {"datadir", required_argument, 0, OPT_DATADIR},
{"pid-file", required_argument, 0, OPT_PID_FILE}, {"pid-file", required_argument, 0, OPT_PID_FILE},
{"bind-address", required_argument, 0, OPT_BIND_ADDRESS}, {"bind-address", required_argument, 0, OPT_BIND_ADDRESS},
...@@ -293,6 +336,7 @@ void parse_args(int argc, char *argv[]) ...@@ -293,6 +336,7 @@ void parse_args(int argc, char *argv[])
{"err-log", required_argument, 0, OPT_ERR_LOG}, {"err-log", required_argument, 0, OPT_ERR_LOG},
{"safe-log", required_argument, 0, OPT_SAFE_LOG}, {"safe-log", required_argument, 0, OPT_SAFE_LOG},
{"mysqld", required_argument, 0, OPT_MYSQLD}, {"mysqld", required_argument, 0, OPT_MYSQLD},
{"help", no_argument, 0, OPT_HELP},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
...@@ -341,6 +385,10 @@ void parse_args(int argc, char *argv[]) ...@@ -341,6 +385,10 @@ void parse_args(int argc, char *argv[])
strcpy(mysqld, optarg); strcpy(mysqld, optarg);
break; break;
case OPT_HELP:
usage();
break;
default: default:
// ignore // ignore
break; break;
...@@ -563,6 +611,8 @@ void mysql_start(int argc, char *argv[]) ...@@ -563,6 +611,8 @@ void mysql_start(int argc, char *argv[])
static char *private_options[] = static char *private_options[] =
{ {
"--autoclose", "--autoclose",
"--check-tables",
"--help",
"--err-log=", "--err-log=",
"--mysqld=", "--mysqld=",
NULL NULL
...@@ -594,7 +644,7 @@ void mysql_start(int argc, char *argv[]) ...@@ -594,7 +644,7 @@ void mysql_start(int argc, char *argv[])
do do
{ {
// check the database tables // check the database tables
check_tables(); if (checktables) check_tables();
// status // status
time(&cal); time(&cal);
......
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