Updated various MaxScale command line and configuration options to allow custom log, module, data, cache and language directories.
This commit is contained in:
@ -137,19 +137,29 @@ ${CMAKE_SOURCE_DIR}/Documentation/Release-Notes/MaxScale-1.1-Release-Notes.md
|
|||||||
execute_process(COMMAND perl ${CMAKE_SOURCE_DIR}/Documentation/format.pl
|
execute_process(COMMAND perl ${CMAKE_SOURCE_DIR}/Documentation/format.pl
|
||||||
${CMAKE_SOURCE_DIR}/Documentation/Upgrading-To-MaxScale-1.1.0.md
|
${CMAKE_SOURCE_DIR}/Documentation/Upgrading-To-MaxScale-1.1.0.md
|
||||||
${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt)
|
${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/Changelog.txt DESTINATION .)
|
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/ReleaseNotes.txt DESTINATION .)
|
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION .)
|
|
||||||
|
|
||||||
message(STATUS "Installing MaxScale to: ${CMAKE_INSTALL_PREFIX}/")
|
message(STATUS "Installing MaxScale to: ${CMAKE_INSTALL_PREFIX}/")
|
||||||
|
|
||||||
install(FILES server/MaxScale_template.cnf DESTINATION etc)
|
if(PACKAGE)
|
||||||
install(FILES server/MaxScale_BinlogServer_template.cnf DESTINATION etc)
|
install(FILES server/MaxScale_template.cnf DESTINATION /etc)
|
||||||
install(FILES ${ERRMSG} DESTINATION mysql)
|
install(FILES server/MaxScale_BinlogServer_template.cnf DESTINATION /etc)
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION .)
|
install(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION /usr/share/maxscale)
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION .)
|
install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION /usr/share/maxscale)
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION .)
|
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/maxscale)
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/Changelog.txt DESTINATION /usr/share/maxscale)
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/ReleaseNotes.txt DESTINATION /usr/share/maxscale)
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION /usr/share/maxscale)
|
||||||
|
else()
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/Changelog.txt DESTINATION .)
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/ReleaseNotes.txt DESTINATION .)
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION .)
|
||||||
|
install(FILES server/MaxScale_template.cnf DESTINATION etc)
|
||||||
|
install(FILES server/MaxScale_BinlogServer_template.cnf DESTINATION etc)
|
||||||
|
install(FILES ${ERRMSG} DESTINATION mysql)
|
||||||
|
install(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION .)
|
||||||
|
install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION .)
|
||||||
|
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION .)
|
||||||
|
endif()
|
||||||
# Install startup scripts and ldconfig files
|
# Install startup scripts and ldconfig files
|
||||||
if(WITH_SCRIPTS)
|
if(WITH_SCRIPTS)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/maxscale.conf.in ${CMAKE_BINARY_DIR}/maxscale.conf @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/maxscale.conf.in ${CMAKE_BINARY_DIR}/maxscale.conf @ONLY)
|
||||||
|
|||||||
@ -113,12 +113,15 @@ static char* server_options[] = {
|
|||||||
|
|
||||||
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
||||||
|
|
||||||
const char* default_cnf_fname = "etc/MaxScale.cnf";
|
const char* default_cnf_fname = "MaxScale.cnf";
|
||||||
|
|
||||||
const char* default_configdir = "/etc/";
|
const char* default_configdir = "/etc/";
|
||||||
const char* default_logdir = "/var/log/maxscale/";
|
const char* default_logdir = "/var/log/maxscale/";
|
||||||
const char* default_libdir = "/lib64/maxscale/lib/";
|
const char* default_datadir = "/var/lib/maxscale/";
|
||||||
const char* default_moddir = "/lib64/maxscale/modules/";
|
const char* default_moduledir = "/lib64/maxscale/modules/";
|
||||||
|
const char* default_cachedir = "/var/cache/maxscale/";
|
||||||
|
const char* default_langdir = "/usr/share/mysql/english/";
|
||||||
|
const char* default_piddir = "/var/run/maxscale/";
|
||||||
|
|
||||||
static char* server_groups[] = {
|
static char* server_groups[] = {
|
||||||
"embedded",
|
"embedded",
|
||||||
@ -132,14 +135,15 @@ static char* server_groups[] = {
|
|||||||
|
|
||||||
/* The data directory we created for this gateway instance */
|
/* The data directory we created for this gateway instance */
|
||||||
static char datadir[PATH_MAX+1] = "";
|
static char datadir[PATH_MAX+1] = "";
|
||||||
|
static bool datadir_defined = false; /*< If the datadir was already set */
|
||||||
/* The data directory we created for this gateway instance */
|
/* The data directory we created for this gateway instance */
|
||||||
static char pidfile[PATH_MAX+1] = "";
|
static char pidfile[PATH_MAX+1] = "";
|
||||||
|
|
||||||
static char* configdir = NULL;
|
static char* configdir = NULL;
|
||||||
static char* logdir = NULL;
|
static char* logdir = NULL;
|
||||||
static char* libdir = NULL;
|
static char* moduledir = NULL;
|
||||||
static char* moddir = NULL;
|
static char* cachedir = NULL;
|
||||||
|
static char* langdir = NULL;
|
||||||
/**
|
/**
|
||||||
* exit flag for log flusher.
|
* exit flag for log flusher.
|
||||||
*/
|
*/
|
||||||
@ -162,8 +166,13 @@ static struct option long_options[] = {
|
|||||||
{"nodaemon", no_argument, 0, 'd'},
|
{"nodaemon", no_argument, 0, 'd'},
|
||||||
{"log", required_argument, 0, 'l'},
|
{"log", required_argument, 0, 'l'},
|
||||||
{"logdir", required_argument, 0, 'L'},
|
{"logdir", required_argument, 0, 'L'},
|
||||||
|
{"datadir", required_argument, 0, 'D'},
|
||||||
|
{"configdir",required_argument, 0, 'C'},
|
||||||
|
{"moduledir",required_argument, 0, 'B'},
|
||||||
|
{"cachedir",required_argument, 0, 'A'},
|
||||||
|
{"language",required_argument, 0, 'N'},
|
||||||
{"syslog", required_argument, 0, 's'},
|
{"syslog", required_argument, 0, 's'},
|
||||||
{"maxscalelog", required_argument, 0, 'S'},
|
{"maxscalelog",required_argument,0,'S'},
|
||||||
{"version", no_argument, 0, 'v'},
|
{"version", no_argument, 0, 'v'},
|
||||||
{"help", no_argument, 0, '?'},
|
{"help", no_argument, 0, '?'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
@ -201,6 +210,14 @@ static bool resolve_maxscale_homedir(
|
|||||||
|
|
||||||
static char* check_dir_access(char* dirname,bool,bool);
|
static char* check_dir_access(char* dirname,bool,bool);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the directory with all the modules.
|
||||||
|
* @return The module directory
|
||||||
|
*/
|
||||||
|
char* get_moduledir()
|
||||||
|
{
|
||||||
|
return moduledir;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Handler for SIGHUP signal. Reload the configuration for the
|
* Handler for SIGHUP signal. Reload the configuration for the
|
||||||
* gateway.
|
* gateway.
|
||||||
@ -369,11 +386,10 @@ void datadir_cleanup()
|
|||||||
{
|
{
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
int flags = FTW_CHDIR|FTW_DEPTH|FTW_MOUNT;
|
int flags = FTW_CHDIR|FTW_DEPTH|FTW_MOUNT;
|
||||||
int rc;
|
|
||||||
|
|
||||||
if (datadir[0] != 0 && access(datadir, F_OK) == 0)
|
if (datadir[0] != 0 && access(datadir, F_OK) == 0)
|
||||||
{
|
{
|
||||||
rc = nftw(datadir, ntfw_cb, depth, flags);
|
nftw(datadir, ntfw_cb, depth, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,14 +410,13 @@ static bool file_write_footer(
|
|||||||
FILE* outfile)
|
FILE* outfile)
|
||||||
{
|
{
|
||||||
bool succp = false;
|
bool succp = false;
|
||||||
size_t wbytes1;
|
|
||||||
size_t len1;
|
size_t len1;
|
||||||
const char* header_buf1;
|
const char* header_buf1;
|
||||||
|
|
||||||
header_buf1 = "------------------------------------------------------"
|
header_buf1 = "------------------------------------------------------"
|
||||||
"\n\n";
|
"\n\n";
|
||||||
len1 = strlen(header_buf1);
|
len1 = strlen(header_buf1);
|
||||||
wbytes1=fwrite((void*)header_buf1, len1, 1, outfile);
|
fwrite((void*)header_buf1, len1, 1, outfile);
|
||||||
|
|
||||||
succp = true;
|
succp = true;
|
||||||
|
|
||||||
@ -412,9 +427,6 @@ static bool file_write_header(
|
|||||||
FILE* outfile)
|
FILE* outfile)
|
||||||
{
|
{
|
||||||
bool succp = false;
|
bool succp = false;
|
||||||
size_t wbytes1;
|
|
||||||
size_t wbytes2;
|
|
||||||
size_t wbytes3;
|
|
||||||
size_t len1;
|
size_t len1;
|
||||||
size_t len2;
|
size_t len2;
|
||||||
size_t len3;
|
size_t len3;
|
||||||
@ -458,9 +470,9 @@ static bool file_write_header(
|
|||||||
#if defined(LAPTOP_TEST)
|
#if defined(LAPTOP_TEST)
|
||||||
nanosleep(&ts1, NULL);
|
nanosleep(&ts1, NULL);
|
||||||
#else
|
#else
|
||||||
wbytes1=fwrite((void*)header_buf1, len1, 1, outfile);
|
fwrite((void*)header_buf1, len1, 1, outfile);
|
||||||
wbytes2=fwrite((void*)header_buf2, len2, 1, outfile);
|
fwrite((void*)header_buf2, len2, 1, outfile);
|
||||||
wbytes3=fwrite((void*)header_buf3, len3, 1, outfile);
|
fwrite((void*)header_buf3, len3, 1, outfile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
succp = true;
|
succp = true;
|
||||||
@ -1023,9 +1035,17 @@ static void usage(void)
|
|||||||
" -lfile or -lshm - defaults to shared memory\n"
|
" -lfile or -lshm - defaults to shared memory\n"
|
||||||
" -L|--logdir=... path to log file directory\n"
|
" -L|--logdir=... path to log file directory\n"
|
||||||
" (default: /var/log/maxscale)\n"
|
" (default: /var/log/maxscale)\n"
|
||||||
" -s|--syslog= log messages to syslog."
|
" -D|--datadir=... path to data directory\n"
|
||||||
|
" (default: /var/lib/maxscale)\n"
|
||||||
|
" -C|--configdir=... path to configuration file directory\n"
|
||||||
|
" (default: /etc/)\n"
|
||||||
|
" -B|--moduledir=... path to module directory\n"
|
||||||
|
" (default: /var/lib/maxscale)\n"
|
||||||
|
" -A|--cachedir=... path to cache directory\n"
|
||||||
|
" (default: /var/cache/maxscale)\n"
|
||||||
|
" -s|--syslog= log messages to syslog.\n"
|
||||||
" True or false - defaults to true\n"
|
" True or false - defaults to true\n"
|
||||||
" -S|--maxscalelog= log messages to MaxScale log."
|
" -S|--maxscalelog= log messages to MaxScale log.\n"
|
||||||
" True or false - defaults to true\n"
|
" True or false - defaults to true\n"
|
||||||
" -v|--version print version info and exit\n"
|
" -v|--version print version info and exit\n"
|
||||||
" -?|--help show this help\n"
|
" -?|--help show this help\n"
|
||||||
@ -1103,9 +1123,8 @@ int main(int argc, char **argv)
|
|||||||
NULL};
|
NULL};
|
||||||
sigemptyset(&sigpipe_mask);
|
sigemptyset(&sigpipe_mask);
|
||||||
sigaddset(&sigpipe_mask, SIGPIPE);
|
sigaddset(&sigpipe_mask, SIGPIPE);
|
||||||
|
|
||||||
progname = *argv;
|
progname = *argv;
|
||||||
|
sprintf(datadir, "%s", default_datadir);
|
||||||
#if defined(FAKE_CODE)
|
#if defined(FAKE_CODE)
|
||||||
memset(conn_open, 0, sizeof(bool)*10240);
|
memset(conn_open, 0, sizeof(bool)*10240);
|
||||||
memset(dcb_fake_write_errno, 0, sizeof(unsigned char)*10240);
|
memset(dcb_fake_write_errno, 0, sizeof(unsigned char)*10240);
|
||||||
@ -1133,7 +1152,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, "dc:f:l:vs:S:?L:",
|
while ((opt = getopt_long(argc, argv, "dc:f:l:vs:S:?L:D:C:B:",
|
||||||
long_options, &option_index)) != -1)
|
long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
bool succp = true;
|
bool succp = true;
|
||||||
@ -1245,6 +1264,33 @@ int main(int argc, char **argv)
|
|||||||
logdir = tmp_path;
|
logdir = tmp_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
if(handle_path_arg(&tmp_path,optarg,NULL,true,false))
|
||||||
|
{
|
||||||
|
langdir = tmp_path;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
sprintf(datadir,"%s",optarg);
|
||||||
|
datadir_defined = true;
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
if(handle_path_arg(&tmp_path,optarg,NULL,true,false))
|
||||||
|
{
|
||||||
|
configdir = tmp_path;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
if(handle_path_arg(&tmp_path,optarg,NULL,true,false))
|
||||||
|
{
|
||||||
|
moduledir = tmp_path;
|
||||||
|
}
|
||||||
|
case 'A':
|
||||||
|
if(handle_path_arg(&tmp_path,optarg,NULL,true,true))
|
||||||
|
{
|
||||||
|
cachedir = tmp_path;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
if(strstr(optarg,"="))
|
if(strstr(optarg,"="))
|
||||||
@ -1547,11 +1593,17 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Use the cache dir for the mysql folder of the embedded library */
|
||||||
|
sprintf(mysql_home, "%s/mysql", cachedir);
|
||||||
|
setenv("MYSQL_HOME", mysql_home, 1);
|
||||||
|
|
||||||
/*<
|
/*<
|
||||||
* If MaxScale home directory wasn't set by command-line argument.
|
* If MaxScale home directory wasn't set by command-line argument.
|
||||||
* Next, resolve it from environment variable and further on,
|
* Next, resolve it from environment variable and further on,
|
||||||
* try to use default.
|
* try to use default.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
|
||||||
if (home_dir == NULL)
|
if (home_dir == NULL)
|
||||||
{
|
{
|
||||||
if (!resolve_maxscale_homedir(&home_dir))
|
if (!resolve_maxscale_homedir(&home_dir))
|
||||||
@ -1560,8 +1612,7 @@ int main(int argc, char **argv)
|
|||||||
rc = MAXSCALE_HOMELESS;
|
rc = MAXSCALE_HOMELESS;
|
||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
sprintf(mysql_home, "%s/mysql", home_dir);
|
|
||||||
setenv("MYSQL_HOME", mysql_home, 1);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1601,13 +1652,28 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
free(log_context);
|
free(log_context);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
char pbuf[PATH_MAX];
|
/**
|
||||||
|
* Resolve the full pathname for configuration file and check for
|
||||||
|
* read accessibility.
|
||||||
|
*/
|
||||||
|
char pathbuf[PATH_MAX+1];
|
||||||
|
snprintf(pathbuf,PATH_MAX,"%s",configdir ? configdir:default_configdir);
|
||||||
|
if(pathbuf[strlen(pathbuf)-1] != '/')
|
||||||
|
strcat(pathbuf,"/");
|
||||||
|
|
||||||
sprintf(pbuf,"%s/etc/MaxScale.cnf",home_dir);
|
if (!resolve_maxscale_conf_fname(&cnf_file_path, pathbuf, cnf_file_arg))
|
||||||
|
{
|
||||||
|
ss_dassert(cnf_file_path == NULL);
|
||||||
|
rc = MAXSCALE_BADCONFIG;
|
||||||
|
goto return_main;
|
||||||
|
}
|
||||||
|
|
||||||
ini_parse(pbuf,cnf_preparser,NULL);
|
ini_parse(cnf_file_path,cnf_preparser,NULL);
|
||||||
|
|
||||||
|
if(!datadir_defined)
|
||||||
|
sprintf(datadir,"%s",default_datadir);
|
||||||
/**
|
/**
|
||||||
* Init Log Manager for MaxScale.
|
* Init Log Manager for MaxScale.
|
||||||
* If $MAXSCALE_HOME is set then write the logs into $MAXSCALE_HOME/log.
|
* If $MAXSCALE_HOME is set then write the logs into $MAXSCALE_HOME/log.
|
||||||
@ -1678,25 +1744,25 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Resolve the full pathname for configuration file and check for
|
|
||||||
* read accessibility.
|
|
||||||
*/
|
|
||||||
if (!resolve_maxscale_conf_fname(&cnf_file_path, home_dir, cnf_file_arg))
|
|
||||||
{
|
|
||||||
ss_dassert(cnf_file_path == NULL);
|
|
||||||
rc = MAXSCALE_BADCONFIG;
|
|
||||||
goto return_main;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*<
|
|
||||||
|
|
||||||
|
if(cachedir == NULL)
|
||||||
|
cachedir = strdup(default_cachedir);
|
||||||
|
|
||||||
|
if(langdir == NULL)
|
||||||
|
langdir = strdup(default_langdir);
|
||||||
|
|
||||||
|
/**
|
||||||
* Set a data directory for the mysqld library, we use
|
* Set a data directory for the mysqld library, we use
|
||||||
* a unique directory name to avoid clauses if multiple
|
* a unique directory name to avoid clauses if multiple
|
||||||
* instances of the gateway are beign run on the same
|
* instances of the gateway are beign run on the same
|
||||||
* machine.
|
* machine.
|
||||||
*/
|
*/
|
||||||
sprintf(datadir, "%s/data", home_dir);
|
|
||||||
|
|
||||||
|
if(datadir[strlen(datadir)-1] != '/')
|
||||||
|
strcat(datadir,"/");
|
||||||
|
strcat(datadir,"data");
|
||||||
if(mkdir(datadir, 0777) != 0){
|
if(mkdir(datadir, 0777) != 0){
|
||||||
|
|
||||||
if(errno != EEXIST){
|
if(errno != EEXIST){
|
||||||
@ -1706,7 +1772,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(datadir, "%s/data/data%d", home_dir, getpid());
|
sprintf(datadir, "%s/data%d", datadir, getpid());
|
||||||
|
|
||||||
if(mkdir(datadir, 0777) != 0){
|
if(mkdir(datadir, 0777) != 0){
|
||||||
|
|
||||||
@ -1720,27 +1786,29 @@ int main(int argc, char **argv)
|
|||||||
if (!daemon_mode)
|
if (!daemon_mode)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Home directory : %s"
|
//"Home directory : %s"
|
||||||
"\nConfiguration file : %s"
|
"Configuration file : %s"
|
||||||
"\nLog directory : %s"
|
"\nLog directory : %s"
|
||||||
"\nData directory : %s\n\n",
|
"\nData directory : %s\n\n",
|
||||||
home_dir,
|
//home_dir,
|
||||||
cnf_file_path,
|
cnf_file_path,
|
||||||
logdir,
|
logdir,
|
||||||
datadir);
|
datadir);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
LOGIF(LM, (skygw_log_write_flush(
|
LOGIF(LM, (skygw_log_write_flush(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"Home directory : %s",
|
"Home directory : %s",
|
||||||
home_dir)));
|
home_dir)));
|
||||||
|
*/
|
||||||
LOGIF(LM, (skygw_log_write_flush(
|
LOGIF(LM, (skygw_log_write_flush(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"Data directory : %s",
|
"Data directory : %s",
|
||||||
datadir)));
|
datadir)));
|
||||||
LOGIF(LM, (skygw_log_write_flush(
|
LOGIF(LM, (skygw_log_write_flush(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"Log directory : %s/log",
|
"Log directory : %s/",
|
||||||
home_dir)));
|
logdir)));
|
||||||
LOGIF(LM, (skygw_log_write_flush(
|
LOGIF(LM, (skygw_log_write_flush(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"Configuration file : %s",
|
"Configuration file : %s",
|
||||||
@ -1758,8 +1826,8 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
snprintf(language_arg,
|
snprintf(language_arg,
|
||||||
11+PATH_MAX+1,
|
11+PATH_MAX+1,
|
||||||
"--language=%s/mysql",
|
"--language=%s",
|
||||||
home_dir);
|
langdir);
|
||||||
server_options[i] = language_arg;
|
server_options[i] = language_arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1815,6 +1883,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
libmysqld_started = TRUE;
|
libmysqld_started = TRUE;
|
||||||
|
|
||||||
|
if(moduledir == NULL)
|
||||||
|
moduledir = strdup(default_moduledir);
|
||||||
|
|
||||||
if (!config_load(cnf_file_path))
|
if (!config_load(cnf_file_path))
|
||||||
{
|
{
|
||||||
char* fprerr = "Failed to load MaxScale configuration "
|
char* fprerr = "Failed to load MaxScale configuration "
|
||||||
@ -2015,7 +2086,7 @@ static int write_pid_file(char *home_dir) {
|
|||||||
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
||||||
snprintf(pidfile, PATH_MAX, "%s/data/maxscale.pid", home_dir);
|
snprintf(pidfile, PATH_MAX, "%smaxscale.pid",default_piddir);
|
||||||
|
|
||||||
fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0777);
|
fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0777);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
@ -2100,21 +2171,42 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
|
|||||||
char pathbuffer[PATH_MAX];
|
char pathbuffer[PATH_MAX];
|
||||||
char* errstr;
|
char* errstr;
|
||||||
|
|
||||||
|
/** These are read from the configuration file. These will not override
|
||||||
|
* command line parameters but will override default values. */
|
||||||
if(strcasecmp(section,"maxscale") == 0)
|
if(strcasecmp(section,"maxscale") == 0)
|
||||||
{
|
{
|
||||||
if(strcmp(name, "logdir") == 0)
|
if(strcmp(name, "logdir") == 0)
|
||||||
{
|
{
|
||||||
/** logdir is only NULL if no command line parameter was given */
|
|
||||||
if(logdir == NULL)
|
if(logdir == NULL)
|
||||||
handle_path_arg(&logdir,(char*)value,NULL,true,true);
|
handle_path_arg(&logdir,(char*)value,NULL,true,true);
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "moddir") == 0)
|
else if(strcmp(name, "moduledir") == 0)
|
||||||
{
|
{
|
||||||
handle_path_arg(&moddir,(char*)value,NULL,true,false);
|
if(moduledir == NULL)
|
||||||
|
handle_path_arg(&moduledir,(char*)value,NULL,true,false);
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "libdir") == 0)
|
else if(strcmp(name, "datadir") == 0)
|
||||||
{
|
{
|
||||||
handle_path_arg(&libdir,(char*)value,NULL,true,false);
|
if(!datadir_defined)
|
||||||
|
{
|
||||||
|
char* tmp;
|
||||||
|
if(handle_path_arg(&tmp,(char*)value,NULL,true,false))
|
||||||
|
{
|
||||||
|
sprintf(datadir,"%s",tmp);
|
||||||
|
datadir_defined = true;
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strcmp(name, "cachedir") == 0)
|
||||||
|
{
|
||||||
|
if(cachedir == NULL)
|
||||||
|
handle_path_arg((char**)&datadir,(char*)value,NULL,true,false);
|
||||||
|
}
|
||||||
|
else if(strcmp(name, "language") == 0)
|
||||||
|
{
|
||||||
|
if(langdir == NULL)
|
||||||
|
handle_path_arg((char**)&langdir,(char*)value,NULL,true,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@
|
|||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
#include <gw.h>
|
||||||
|
|
||||||
/** Defined in log_manager.cc */
|
/** Defined in log_manager.cc */
|
||||||
extern int lm_enabled_logfiles_bitmask;
|
extern int lm_enabled_logfiles_bitmask;
|
||||||
@ -146,16 +147,16 @@ MODULE_INFO *mod_info = NULL;
|
|||||||
|
|
||||||
if (access(fname, F_OK) == -1)
|
if (access(fname, F_OK) == -1)
|
||||||
{
|
{
|
||||||
home = get_maxscale_home ();
|
//home = get_maxscale_home ();
|
||||||
snprintf(fname, MAXPATHLEN+1,"%s/modules/lib%s.so", home, module);
|
snprintf(fname, MAXPATHLEN+1,"%s/lib%s.so", get_moduledir(), module);
|
||||||
|
|
||||||
if (access(fname, F_OK) == -1)
|
if (access(fname, F_OK) == -1)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : Unable to find library for "
|
"Error : Unable to find library for "
|
||||||
"module: %s.",
|
"module: %s. Module dir: %s",
|
||||||
module)));
|
module, get_moduledir())));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,3 +65,4 @@ int gw_write(DCB *dcb, const void *buf, size_t nbytes);
|
|||||||
int gw_getsockerrno(int fd);
|
int gw_getsockerrno(int fd);
|
||||||
int parse_bindconfig(char *, unsigned short, struct sockaddr_in *);
|
int parse_bindconfig(char *, unsigned short, struct sockaddr_in *);
|
||||||
int setipaddress(struct in_addr *, char *);
|
int setipaddress(struct in_addr *, char *);
|
||||||
|
char* get_moduledir();
|
||||||
Reference in New Issue
Block a user